1

I want to write a C-program that gets some strings from input. I want to save them in a MySQL database. For security I would like to check, if the input is a (possible) UTF-8 string, count the number of characters and also use some regular expressions to validate the input.

Is there a library that offers me that functionality?

I thought about to use wide characters, but as far as I understood, the fact if they are supporting UTF-8 depends on the implementation and ist not defined by a standard. And also I would be missing the regular expressions.

Adam Wagner
  • 15,469
  • 7
  • 52
  • 66
HeLLo
  • 11
  • 1

1 Answers1

1

PCRE supports UTF-8. To validate the string before any processing, the W3C suggests this expression, which I re-implemented in plain C, but PCRE already automatically checks for UTF-8 in accordance to RFC 3629.

Community
  • 1
  • 1
Christoph
  • 164,997
  • 36
  • 182
  • 240