bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about C sscanf and unicode


From: jkjdll
Subject: Question about C sscanf and unicode
Date: Mon, 14 Sep 2020 19:58:47 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

Hi,

I am a contributor to an mail hypertext archiving system called
hypermail [1], which is written in C.

Recently a bug was raised that one of its parsers had problems
when the input string had a nbsp. As you may imagine from my subject,
this is because that parser uses sscanf and the nbsp corresponds
to UTF-8 U+00A0 character:

  urlscan = sscanf(inputp, "%255[^] )<>\"\'\n[\t\\]", urlbuff);

o you know if there's an sscanf function that is UTF-8 aware?
Or, if it doesn't exist, an alternative method to be able to solve
this issue? For the moment I see two possibilities:

- As the code is already using PCRE, replace all space chars by the
  simple 0x20, temporarily, while seeing if we can replace the sscanf
  eventually by regexps.

- Convert the input string to wchar and use swscanf instead.

If you have any input on the above, I'd appreciate it very much.

Thank you in advance,

--josé

[1] https://github.com/hypermail-project/hypermail



reply via email to

[Prev in Thread] Current Thread [Next in Thread]