Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,comp.lang.basic.visual
external usenet poster
 
Posts: 4
Default VB strings, MSXML, Latin 9, and the Euro

Hi,

I have an Excel application which is receiving XML via MSXML4, encoded
with charset=ISO-8859-15. The XML text may contain the Euro symbol. I
want to place the text into a VB string, and sometime later, a cell.

If I decode the XML text into a byte array, I can see that the Euro
has been correctly decoded using the Windows charset CP1252 to the
value 128 (0x80).

However if I create an empty string and append the VB Euro symbol -

Dim str as String
Dim b() as Byte

str = Chr(128)
b = str

msgbox "high byte=" & b(0) & ", low byte=" & b(1)

I find that the Euro should be encoded with high and low values of 177
& 32. So when I create a VB string from the XML text, the Euro
character is completely wrong.

I'd really appreciate any insight into what's happening here, and how
to correctly specify the charset when I create the VB string, or
alternatively, the correct character set to use on the XML encoding
side.

Many thanks,

Rod
  #2   Report Post  
Posted to microsoft.public.excel.programming,comp.lang.basic.visual
external usenet poster
 
Posts: 2
Default VB strings, MSXML, Latin 9, and the Euro


"Rod Good" wrote in message
om...
Hi,

I have an Excel application which is receiving XML via MSXML4, encoded
with charset=ISO-8859-15. The XML text may contain the Euro symbol. I
want to place the text into a VB string, and sometime later, a cell.

If I decode the XML text into a byte array, I can see that the Euro
has been correctly decoded using the Windows charset CP1252 to the
value 128 (0x80).

However if I create an empty string and append the VB Euro symbol -

Dim str as String
Dim b() as Byte

str = Chr(128)
b = str

msgbox "high byte=" & b(0) & ", low byte=" & b(1)

I find that the Euro should be encoded with high and low values of 177
& 32. So when I create a VB string from the XML text, the Euro
character is completely wrong.

I'd really appreciate any insight into what's happening here, and how
to correctly specify the charset when I create the VB string, or
alternatively, the correct character set to use on the XML encoding
side.

Many thanks,

Rod


I don't know about displaying it in Excel, but I can tell you this much:

The Euro symbol is Chr(128) in what on my machine (XP) is called
"Windows: Western" in the Character Map program. I assume this is the
same character set as ISO-8859-15, and it is a 256 character 8 bit
character set.

The Euro symbol in Unicode is hex 20AC. This is a 64K character 16 bit
character set. (Hex 20 is 32, and Hex AC is 172, which should be the two
bytes you got. In Windows, 16 bit values are stored low byte, high
byte).

VB strings are Unicode strings. What Excel spreadsheet cells take, I
don't know. But at least that explains more or less what is going on.
You still get to figure what to do about it.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
Adding together two Latin Squares KevinUK Excel Discussion (Misc queries) 2 January 9th 08 07:01 PM
How to find number of pairs of strings from list of strings? greg_overholt Excel Worksheet Functions 5 January 27th 06 10:42 PM
How do I automatically insert the latin tree names sueCBA Excel Discussion (Misc queries) 3 October 6th 05 03:56 PM
How can I count strings within strings Paul W Excel Worksheet Functions 4 June 14th 05 12:39 PM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"