470,625 Members | 1,960 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,625 developers. It's quick & easy.

The nature of string and char[] in .NET

Hello,

I'm trying to write a converter for converting between Big5 and UTF-8,
but I want to make sure a few facts before writing.

1) I know that by default .NET store string in unicode. Would there be
any problem if I store Big5 characters in the string? Or could I set the
codepage setting for individual string?

2) There are basically three types of Unicode scheme - UTF-7, UTF-8 and
UCS-2. Which one does the default Unicode setting refer to?

3) Same as 1) but this time is for char[].

I'm writing this because the webpage I'm writing is in Unicode, it
stores data to MySQL database which store data in Big5, and we also have a
backend written in VB6 which would be nearly rewritting if need to change to
Unicode. Here, I plan to translate the data immediately when read from the
database and vice versa so no other existing part need to be changed. I'm
using LibEx with MyODBC for accessing MySQL.

This post will be crossposted to
microsoft.public.dotnet.internationalization.(The i18n group seems more
appropiate, but as I'm also asking how strings are stored in .NET
applications, I think it's also good to post in here.)

Any advice would be greatly appreciated. Whether for the questions or
for a better way to fatch the data so no manual translation is needed. :)

Thanks in advance.

Regards,
Lau Lei Cheong
Nov 18 '05 #1
3 1055
Hi,

1) you can set application encoding in web.config :

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>

2) you can convert from one encoding to others by using
Encoding.Convert Method :
http://msdn.microsoft.com/library/de.../en-us/cpref/h
tml/frlrfSystemTextEncodingClassConvertTopic1.asp

HTH

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
"Natty Gur" <na***@dao2com.com> ???
news:eY**************@TK2MSFTNGP10.phx.gbl ???...
Hi,

1) you can set application encoding in web.config :

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/> Thanks for the information. :)
2) you can convert from one encoding to others by using
Encoding.Convert Method :
http://msdn.microsoft.com/library/de.../en-us/cpref/h
tml/frlrfSystemTextEncodingClassConvertTopic1.asp

It's pity that my attempt to follow this has failed. The modified function
only return question marks to the database.
Seems more modifications is needed for converting multibyte characters.

I've worked so far success to convert unicode string to byte array(big5 code
equivalent). Now I need to convert it back to string. Any idea on that?
Thanks a lot.
Nov 18 '05 #3
Hi,

send me mail. i've back at work sample code that dose it for hebrew
visual to unicode.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Gaurav | last post: by
2 posts views Thread by Andrew | last post: by
16 posts views Thread by Khuong Dinh Pham | last post: by
16 posts views Thread by Don Starr | last post: by
7 posts views Thread by al | last post: by
3 posts views Thread by jacob navia | last post: by
8 posts views Thread by Lawrence D'Oliveiro | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.