-------- Original-Nachricht -------- > Datum: Mon, 15 Sep 2008 17:49:15 +0900 > Von: "Wu Nan" <i.wunan+rubymail / gmail.com> > An: ruby-talk / ruby-lang.org > Betreff: How to convert the charset of texts in a Execl which has multi-language text and charset? > Hello all, > > I want to use Ruby to read a excel file's content and convert them in to > UTF-8. > However, in that file there are many different language texts, such as > Greek, Japanese, Korea, Russia and so on. > So I use Iconv to convert the them into UTF-8. > I searched the internet, some article said the default charset of Excel is > UTF-16LE. > So I use the codes below: > > Iconv.conv("UTF-8","UTF-16",$excel.Cells(row,col).value.to_s) > > And the contents in excel are(each line is a cell) > ---------------------------------------- > (Please wait) > (Veuillez attendre) > (Bitte warten) > (Espere un momento) > (Attendere, prego) > (Even geduld aub) > (§¨§Õ§Ú§ä§Ö) > (Aguarde) > ( ) > > ------------------------------------------ > After I run it, I get a Error: > in `conv': ")" (Iconv::InvalidCharacter) > > It seems that the in UTF-16, the ( is not '('????????? > > Then I changed the 'UTF-16' in to 'GB2312'(the default charset of my > system),but it cannot convert the Koean character correctly. All the Koean > characters became ????????????????? > > I use Ruby 1.8.6 on WinXP Sp3. > > How could I resolve it ? > > Many thanks, > > Nan Dear Nan, after some searching, I found that there is a special encoding for Korean characters, EUC-KR. I managed to convert your Korean text from UTF-8 to EUC-KR, write it to a file and display it correctly in Firefox, once the right encoding is set in the Preferences (EUC-KR in this case, but I can also display Korean text in UTF-8.) So I think you'll be successful by making sure you convert from EUC-KR to UTF-8 for the Korean, and to UTF-8 for everything else. Best regards, Axel -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser