title: Language detection / Character detection with ICU - International Components for Unicode
body: <p>I'm trying to do a language detection with ICU. My code works well for ISO-8859-1 (Danish, Dutch, English, French, German, Italian, Norwegian, Portuguese, Swedish). But I don't find how I can detect Korean, Japanese ... language. Can you help me ? My code:</p>
  
  <pre><code>void                        languageDetection(char *str)
  {
      UCharsetDetector        *csd;
      const UCharsetMatch     *csm;
      const char              *name;  
      const char              *lang;  
      int32_t                 len = strlen(str);
      int32_t                 confidence;
      UErrorCode              status = U_ZERO_ERROR;
  
      csd = ucsdet_open(&amp;status);  
      if(status != U_ZERO_ERROR)  
          printf("ERROR: in ucsdet_open :%s\n", u_errorName(status));  
  
      ucsdet_setText(csd, str, -1, &amp;status);  
      if(status != U_ZERO_ERROR)  
          printf("ERROR: in ucsdet_setText :%s\n", u_errorName(status));
  
      csm = ucsdet_detect(csd, &amp;status);  
      if(status != U_ZERO_ERROR)  
          printf("ERROR: in ucsdet_detectAll :%s\n", u_errorName(status));
  
      name = ucsdet_getName(csm, &amp;status);
      if(status != U_ZERO_ERROR)  
          printf("ERROR: in ucsdet_getName :%s\n", u_errorName(status));
  
      lang = ucsdet_getLanguage(csm, &amp;status);
      if(status != U_ZERO_ERROR)  
          printf("ERROR: in ucsdet_getLanguage :%s\n", u_errorName(status));
  
      confidence = ucsdet_getConfidence(csm, &amp;status);
      if(status != U_ZERO_ERROR)  
          printf("ERROR: in ucsdet_getConfidence :%s\n", u_errorName(status));
  
      printf("%s (%s) %i\n", name, lang, confidence);
  
      ucsdet_close(csd);
  }
  </code></pre>
  
  <p>Thanks a lot</p>