EDN Admin
Well-known member
Hi all,
Im new with VB.Net. Ive search MSDN and found out how to get bytes from a string. Heres some sample code of mine
<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
Dim encode As New UTF8Encoding
Console.WriteLine(encode.GetByteCount("と"))
This sample show how many bytes of the japanese characters. And the result is 3. Another sample code
<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
Dim encode As New UTF8Encoding
Console.WriteLine(encode.GetByteCount("â"))
The 2nd sample code return result 2.
Ok let me explain my reason, I wanna check size of kanji and kana chars ( japanese chars if you dont know) , if the size of char is 1 byte, its halfsize and 2 byte, its fullsize. Everything is done with encode is UTF-8, but I dont understand why the result with japanese chars is always 3, Ive asked my friends, they dont understand too, they thought that every chars are displayed with 1 bytes or 2 bytes only, never heard of 3 bytes chars, and so did I.
Everyone who understands the problem, please explain to me why the sample code 1 return result 3 and the 2nd return result 2.
And btw, does anyone know the utf-8 characters code of kanji and katakana characters in bytes, I mean, like ASCII character code, 33 means "!".
Im so sorry if my English is bad, Im trying my best to improve my english skill <img alt=Sad src="http://forums.microsoft.com/MSDN/emoticons/emotion-6.gif . But please help me with this problem. Thanks
View the full article
Im new with VB.Net. Ive search MSDN and found out how to get bytes from a string. Heres some sample code of mine
<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
Dim encode As New UTF8Encoding
Console.WriteLine(encode.GetByteCount("と"))
This sample show how many bytes of the japanese characters. And the result is 3. Another sample code
<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
Dim encode As New UTF8Encoding
Console.WriteLine(encode.GetByteCount("â"))
The 2nd sample code return result 2.
Ok let me explain my reason, I wanna check size of kanji and kana chars ( japanese chars if you dont know) , if the size of char is 1 byte, its halfsize and 2 byte, its fullsize. Everything is done with encode is UTF-8, but I dont understand why the result with japanese chars is always 3, Ive asked my friends, they dont understand too, they thought that every chars are displayed with 1 bytes or 2 bytes only, never heard of 3 bytes chars, and so did I.
Everyone who understands the problem, please explain to me why the sample code 1 return result 3 and the 2nd return result 2.
And btw, does anyone know the utf-8 characters code of kanji and katakana characters in bytes, I mean, like ASCII character code, 33 means "!".
Im so sorry if my English is bad, Im trying my best to improve my english skill <img alt=Sad src="http://forums.microsoft.com/MSDN/emoticons/emotion-6.gif . But please help me with this problem. Thanks
View the full article