Re: UTF-8

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Tony Proctor wrote:
It depends Lou. If your locale is appropriate for the characters you want to show then it's easy. If not then it is difficult.

For instance, if your UTF-8 represents Chinese characters, and your locale is currently Chinese, then it's only a few lines of code. However, if your locale is something like West European then I'm not sure I have a reliable answer I can give you

I think someone suggested using a Web Browser control. That's probably the best solution I've heard in the difficult case since Internet Explorer takes care of it's own fonts for different locales

Here's a bit of code that will convert between UTF-8 from a file and Unicode (which is what VB uses in memory). The sample then writes the Unicode to a different ANSI file but you can just cut that bit out: http://groups.google.ie/group/microsoft.public.vb.general.discussion/msg/00f3c3fd8182563e?hl=en

Tony Proctor


I had no problems using Tony's code (in the link above) to load a sample UTF-8 text file into Edanmo's RichEdit Control v3 using a suitable Unicode font.

If the users have MS Office installed, then they will already have Arial Unicode MS (a suitable font for most languages).

So, go to http://www.mvps.org/emorcillo/en/code/vb6/index.shtml and get:
http://www.mvps.org/emorcillo/download/vb6/tl_ole.zip
http://www.mvps.org/emorcillo/download/vb6/ctl_riched.msi

The advantage of the above (over other suggestions) is that you can have several languages in the one box, and/or be able to edit them.
.



Relevant Pages

  • Re: UTF-8
    ... For instance, if your UTF-8 represents Chinese characters, and your locale ... Here's a bit of code that will convert between UTF-8 from a file and Unicode ...
    (microsoft.public.vb.general.discussion)
  • Re: ???????????????
    ... - he is running slrn in a UTF-8 locale ... When running e.g. in a iso-8859-1 locale there is no way to translate ... chinese characters into iso-8859-1 characters. ... locale on my own computer to UTF-8 was a Japanese sig file in another ...
    (news.software.readers)
  • Help on unicode characters in Linux
    ... Unicode. ... Assuming I have a text file containing chinese characters, ... the locale has been set to UTF and I am able to view the ...
    (microsoft.public.vc.mfc)
  • Re: Unicode Delphi Win32 - which approach
    ... I like the backwards compatibility aspects of UTF-8 vs UTF-16. ... The first 256 Unicode characters map to the ANSI character set. ... entire stream> but calling an API 100 times in a loop I can imagine. ... and explicitly contextualise every string. ...
    (borland.public.delphi.non-technical)
  • Re: Unicode string libraries
    ... UTF-8 is the encoding that must be used ... I initially thought that the variable-length characters ... but also that UTF-8 didn't break when Unicode got extended ...
    (comp.programming)