Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two lines of code - what's wrong?

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
GB
Hi,

Does anyone out there have Chinese Windows?

If you write this code in the immediate pane in VB:

N$ = chr$(200)
?Asc(N$)

it returns 0 instead of 200. This applies to any values over 128, and it's totally screwed up my program for anyone running Chinese Windows.

Do I need to recompile for s double-byte character set or is there an easy work-around?

Thanks,

- Andy.
 
Look at chrW also under Chr
"Note The ChrB function is used with byte data contained in a String. Instead of returning a character, which may be one or two bytes, ChrB always returns a single byte. The ChrW function returns a String containing the Unicode character except on platforms where Unicode is not supported, in which case, the behavior is identical to the Chr function."

 
Hi John,

Thanks for the info, it helped.

Can you make any further suggestions? If I replace all Chr$() functions with ChrW() and all Asc() with AscW() then in theory it will work on either platform.

However, if I build a string using the ChrW function and then write it to a binary file, it replaces some of the characters with '?' (such as characters 130 to 139). So then when I read the string back out of the file it's full of question marks.

In other words, the solution only works as long as the strings remain in memory. How do I read / write the strings to a file using the Put and Get methods?

Thanks again, even if you can't help further!

- Andy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top