Alaska Software Inc. - UTF8 conversion
Username: Password:
AuthorTopic: UTF8 conversion
Rudolf ReinthalerUTF8 conversion
on Thu, 08 May 2014 10:29:53 +0200
Hello,
I have some problems to convert a XML from and back to UTF8. I have to 
edit vars from a XML with german Umlaute like öäüß etc. This vars I 
convert from UTF8 to OEM with Pablos OT4XB and cOemToUtf8() and 
cUtf8ToOem(), so far no problem.
But when I convert a already converted string again, the result is 
wrong. But how can I prevent this ? I have made my own conversion with 
the attached function, here I have no problems, converting multiple 
times does not destroy the result. But my function is only for some 
charactes and not complete.
regards
Rudolf


fromutf8(cRet)
      cRet  := strtran(cRet ,chr(195)+chr(132),"Ä")
      cRet  := strtran(cRet ,chr(195)+chr(150),"Ö")
      cRet  := strtran(cRet ,chr(195)+chr(156),"Ü")
      cRet  := strtran(cRet ,chr(195)+chr(164),"ä")
      cRet  := strtran(cRet ,chr(195)+chr(182),"ö")
      cRet  := strtran(cRet ,chr(195)+chr(188),"ü")
      cRet  := strtran(cRet ,chr(195)+chr(159),"ß")
      cRet  := strtran(cRet ,chr(226)+chr(130)+chr(172),"€")
      return cRet

toutf8(cRet)
      cRet  := strtran(cRet,"Ä",chr(195)+chr(132)  )
      cRet  := strtran(cRet,"Ö",chr(195)+chr(150)   )
      cRet  := strtran(cRet,"Ü",chr(195)+chr(156)  )
      cRet  := strtran(cRet,"ä",chr(195)+chr(164)  )
      cRet  := strtran(cRet,"ö",chr(195)+chr(182)  )
      cRet  := strtran(cRet,"ü",chr(195)+chr(188)  )
      cRet  := strtran(cRet,"ß",chr(195)+chr(159)  )
      cRet  := strtran(cRet,"€",chr(226)+chr(130)+chr(172) )
      return cRet

---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
http://www.avast.com