I am working on an application that supports several languages โโand has functionality that tries to use the language requested by the browser, and also allows manual overriding of this function. This part works great and selects the correct templates, labels, etc.
The user sometimes needs to enter text on his own and that I run into problems, because the application must accept even "complex" languages, such as Chinese and Russian. So far, I have taken care of the things mentioned in other posts, i.e.:
- call
mb_internal_encoding( 'UTF-8' ) - setting the correct encoding when rendering web pages using
meta http-equiv=Content-Type content=text/html;charset=UTF-8(format adapted due to stack flow restrictions) - even the content is doing right because
mb_detect_encoding() == UTF-8 - tried to install
setLocale(LC_CTYPE, "UTF-8"), which doesnโt seem to work, because it requires a choice of one language, which I cannot specify, because I need to support several. And it still fails if I force it manually check, i.e. WITH; setLocale(LC_CTYPE,"zh__CN.utf8")- ctype_alpha()will still fail for the Chinese text
It seems that even an explicit choice of language does not make it ctype_alpha()useful.
Therefore, the question arises: how should I check alphabetical characters in all languages?
The only idea I had at the moment was to manually check with arrays of "valid" characters, but that seems ugly, especially for the Chinese.
Please let me know how you solve this problem.
Many thanks!