With the partying over (last month was my one year anniversary), I thought that I should get down and answer some of those excellent questions you have been asking. This column covers:
| UTF–8 Codepage??? | |
| Set font.charset for Visual Basic Control | |
| Hebrew and XML | |
| Three Letter Language Acronyms |
We are planning to store UTF–8 data into VARCHAR LATIN 1 (I know that the column should probably be GRAPHIC or BINARY to be safe) database column and have it retrieved by the 95/98/2000 clients. Then we want to use the UTF–8 code page? to display & print the data. We are not fully ready for Unicode that is why we are trying to find a way to pass the data around without a lot of transformation.
decoder–8
Dear decoder–8,
No, because UTF–8 is an encoding for Unicode, a UTF–8 codepage does not exist. That does not mean you can not display data encoded in UTF–8. For example, IE can do it even on Win9x. (this means, in particular, that some kind of a Web service / ASP page can push content in UTF–8 to Win95 clients)
You can process UTF–8 on all Windows platforms uniformly if you use MLang. It does not provide you with the means to display text, but you can convert UTF–8 to an encoding supported by the client before you display it.
Hi, what would be the "tidiest" way to set the font.charset property of a Visual Basic control based on the user's locale?
well organized
Dear organized,
You have to use two Win32 APIs and one Win32–defined structure. With LCID in hand, call GetLocaleInfo to get the default ANSI codepage of the locale. Then create an instance of CHARSETINFO and pass it to TranslateCharsetInfo along with the codepage. The CHARSETINFO.ciCharset will contain the charset you need.
I have a problem with Hebrew in xml.
I'm building a program in VB that puts an exchange message body, written in xml, into a string. When I use the xmlDoc.LoadXML command to read the string, I get ?????? instead of Hebrew. I have tried to add the tag <?xml version='1.0' encoding='windows–1255'?>, but when I do, I can't read the string at all.
The only way I have been able to read the data correctly is by adding the <?xml version='1.0' encoding='windows–1255'?> tag and my xml data into an attachment, and then open the attachment with FSO. I then save it as a temp file and read it with the xmlDoc.Load command.
Is there an easy way to fix the problem?
from the internet
Dear from,
You may experience this problem for a couple of reasons. It depends on the version of the MSXML object you use:
1. | With versions 2.5, 2.5 SP1 and 2.6 of the MSXML parser, the loadXML method of IXMLDOMDocument can only load UTF–16 or UCS–2 encoded data. Any attempt to load XML data that is encoded with another encoding format results in an error. |
2. | If you use MSXML ver. 3.0, the problem has been resolved – but note to make sure the encoding of the file matches the one declared in the header. |
TLA–seeker
Dear seeker,
Because I get this question a lot, I have added a list of these acronyms to Globaldev. It is a list of the 3–letter language codes that Windows XP uses for the languages of each of its supported locales.
Keep those questions coming!
Dr. International
Windows Division