Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > The nature of string and char[] in .NET

Reply
Thread Tools

The nature of string and char[] in .NET

 
 
Lau Lei Cheong
Guest
Posts: n/a
 
      06-04-2004
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


 
Reply With Quote
 
 
 
 
Natty Gur
Guest
Posts: n/a
 
      06-04-2004
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!
 
Reply With Quote
 
 
 
 
Lau Lei Cheong
Guest
Posts: n/a
 
      06-04-2004
"Natty Gur" <(E-Mail Removed)> ???
news:(E-Mail Removed) ???...
> 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.


 
Reply With Quote
 
Natty Gur
Guest
Posts: n/a
 
      06-05-2004
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nature of Space and Time on DVD nekoogar@multiversaljourneys.com DVD Video 0 04-15-2006 06:03 PM
Seeking advice on digital body and lens setup in 2-3K range for nature shooting... MrMyke Digital Photography 3 04-17-2004 08:38 PM
perl bug File::Basename and Perl's nature Xah Lee Python 14 01-27-2004 08:20 AM
the nature of color, reproduction and perception hbarta@comcast.net Digital Photography 4 08-15-2003 02:22 PM
WWW: Win A Copy Of Two Weeks Notice and Human Nature. Chris Marin DVD Video 0 08-07-2003 08:58 PM



Advertisments