tags:

views:

28

answers:

1

Hi,

I want to write a C-programm 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.

So my question is the following: 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.

Thanks for reading and have a nice day.

HeLLo

+1  A: 

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.

Christoph
+1 I hated the question (I don't like regexps), and you had such a neat answer.
Amigable Clark Kant