Re: Determining encoding (Thai)
From: John J. Hughes II (no_at_invalid.com)
Date: 08/01/04
- Next message: Mattias Sjögren: "Re: Reflection Question: Determining and invoking a Control's event handlers"
- Previous message: nicolas: "Re: A HREF and AXwebbrowser"
- In reply to: Jon Skeet [C# MVP]: "Re: Determining encoding (Thai)"
- Next in thread: Jon Skeet [C# MVP]: "Re: Determining encoding (Thai)"
- Reply: Jon Skeet [C# MVP]: "Re: Determining encoding (Thai)"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 1 Aug 2004 14:22:53 -0400
Well what I had done is basically the same as you suggested. There is no
value in the upper byte. If I switch to your method I get 0x00BF for the
first value instead of 0xBF is all. I know I said byte in my message but I
was using int32. Since there was no upper value I am assuing the data is
being recorded as a byte and that is how C# is reading it even if a char is
longer then a byte.
string s = (string)dr["Location"];
System.Diagnostics.Debug.WriteLine("line");
foreach(char c in s)
{
System.Diagnostics.Debug.Write(Convert.ToInt32(c).ToString("X") + ",");
}
System.Diagnostics.Debug.WriteLine("");
Using your method:
00bf
00a1
00b4
00bf
00cb
00a1
00d3
00e4
00e8
00e4
00d3
00b9
00be
00c3
00e4
00d3
00be
00b9
00d0
00c2
00e0
00b9
00bf
00b4
00a1
00cb
00e0
00bf
00c2
00d3
00e4
00be
00a4
00e9
00e8
00d0
00c2
00b9
00c3
00bf
00e0
00e8
00b4
00c2
00be
00d3
00b5
00bf
00a4
00e9
00d0
00e0
00bf
00b9
00c3
00b4
00cb
00a1
00d5
00e0
00bf
00b4
00a1
00bf
00cb
00a1
00b4
00bf
00cb
00a1
00b4
00cb
00a1
00b4
00bf
00cb
00a1
00b4
00cb
00bf
00a1
00b4
004c
0061
0070
0020
0070
0068
006f
006e
0065
0020
0075
0073
0065
0020
0066
006f
0072
0020
0074
0065
0073
0074
0069
006e
0067
0020
0074
0068
0069
0073
0020
0052
0041
004d
0053
002c
0020
0077
006f
0077
0021
Regards,
John
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1b76a1041312c3a398b052@msnews.microsoft.com...
> John J. Hughes II <no@invalid.com> wrote:
> > Well I am pretty sure it's not UNICODE but just to look. The Thai
UNICODE
> > seems to all start with 0x0E??. The data I am getting from the SQL all
> > seems to start with 0xb?. Now if it's DBCS then the the first one below
is
> > 0xBFA1. I may look into the font tomorrow and see what values it has.
> >
> > Sample string byte decoded.
> >
BF,A1,B4,BF,CB,A1,D3,E4,E8,E4,D3,B9,BE,C3,E4,D3,BE,B9,D0,C2,E0,B9,BF,B4,A1,C
> >
B,E0,BF,C2,D3,E4,BE,A4,E9,E8,D0,C2,B9,C3,BF,E0,E8,B4,C2,BE,D3,B5,BF,A4,E9,D0
> > ,E0,BF,B9,C3,B4,CB,A1,D5,E0,BF,B4,A1,
>
> Sorry, I should have been clear - I don't mean how it is byte-decoded,
> I mean how it is in the Unicode string after you've read it from the
> database. You can print out the contents of the string with something
> like:
>
> foreach (char c in theString)
> {
> Console.WriteLine ("{0:x4}", (int)c);
> }
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too
- Next message: Mattias Sjögren: "Re: Reflection Question: Determining and invoking a Control's event handlers"
- Previous message: nicolas: "Re: A HREF and AXwebbrowser"
- In reply to: Jon Skeet [C# MVP]: "Re: Determining encoding (Thai)"
- Next in thread: Jon Skeet [C# MVP]: "Re: Determining encoding (Thai)"
- Reply: Jon Skeet [C# MVP]: "Re: Determining encoding (Thai)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|