1

Possible Duplicate:
Detect language from string in PHP

I want to do a test on the language of input data. For example: if the user sends data in one other language (Chinese, Japanese, Arabic, ...) an error message appears asking him to enter this data in English.

Community
  • 1
  • 1
Kohan95
  • 10,019
  • 5
  • 20
  • 21
  • Will this data be coming in as UTF-8? You mention that the user is sending data, so I am guessing that this won't be direct input from the user. – Gangadhar Apr 10 '12 at 17:27
  • Look this ["How to detect the language of a document - in PHP?"](http://stackoverflow.com/questions/290851/how-to-detect-the-language-of-a-document-in-php), especially accepted answer. – Wh1T3h4Ck5 Apr 10 '12 at 17:31
  • [How to detect language of text?](http://stackoverflow.com/questions/2752691/how-to-detect-language-of-text) is also pretty close. – Ilmari Karonen Apr 10 '12 at 17:32
  • example if the user enters the text: 你好 or مرحبا ... for this an error message appears. The value of $test must be in English – Kohan95 Apr 10 '12 at 17:47
  • To be more precise this is what I want to do for example if the user :testهذه هي بعض النصوص العربية an error message appears – Kohan95 Apr 11 '12 at 00:09
  • here's a simple solution I test the ASCII code of character entered:
     
            
    
     
    
    what do you think
    cordially
    Kohan
    – Kohan95 Apr 11 '12 at 01:07
  • sorry i don't know how can i format my code with stackoverflow :-( – Kohan95 Apr 11 '12 at 01:10
  • I do not know why you close my topic?!!!!!!!!!! it's a Duplicate – Kohan95 Apr 11 '12 at 01:13
  • hello Please can you open my topic? because I do not believe that it is a duplicate thank you in advance for your rethinks cordially Kohan – Kohan95 Apr 11 '12 at 01:23

0 Answers0