Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Internationalization / March 2006

Tip: Looking for answers? Try searching our database.

Database and Localized strings

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
VC - 15 Mar 2006 00:27 GMT
Hi,
Greetings. I am not sure if this is the correct forum for this question. I
there is a different place, please point me in that direction. Thanks in
advance.

A C#.NET (VS-2003) application needs to insert Chinese/Asian characters into
a back-end database (SYBASE) programatically, say, ADO.NET.

Another C#.NET application has to read this data back from the database and
write into a file.

The development and runtime environments are EN-US (US English), but what
should I do to accomplish this task? I tried normal ADO.NET classes for
inserting and retrieving the data. That does not seem to do the trick. I am
missing some configuration or not using the correct methods to PUT/GET the
data.

Any pointers will be greatly appreciated.

Thanks again,
~vc
Mihai N. - 15 Mar 2006 07:21 GMT
> The development and runtime environments are EN-US (US English), but what
> should I do to accomplish this task? I tried normal ADO.NET classes for
> inserting and retrieving the data. That does not seem to do the trick. I am
> missing some configuration or not using the correct methods to PUT/GET the
> data.

Make sure you are using Unicode thruought. UTF-8 for the form, database ising
NVARCHAR and NCHAR, and so on.

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

VC - 15 Mar 2006 20:14 GMT
Hi Mihai,
Thanks for the input. Appreciate your time.
I am working with a Console application and have been trying to test
inserting some ASIAN character strings into a back-en Sybase Database using
ADO.NET provider (Sybase), with no luck. Do i need to set any specific
encoding while making the datareader or dataset methods. Currently I have
specified the ENCODING as UNICODE in my connection string. Maybe I should
also use a different accessor method to retrieve the data from the
dataset/datareader which has the encoding information.

Any clues, suggestions on this front...?

Thanks again,
~vc
>> The development and runtime environments are EN-US (US English), but what
>> should I do to accomplish this task? I tried normal ADO.NET classes for
[quoted text clipped - 7 lines]
> ising
> NVARCHAR and NCHAR, and so on.
Mihai N. - 17 Mar 2006 09:02 GMT
> I am working with a Console application and have been trying to test
> inserting some ASIAN character strings into a back-en Sybase Database using
[quoted text clipped - 3 lines]
> also use a different accessor method to retrieve the data from the
> dataset/datareader which has the encoding information.
Do you have a way to avoid the console?
It is very weak in dealing with Unicode.

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

VC - 17 Mar 2006 19:50 GMT
Hi Mihai,
Thanks for the followup. Would a .NET form application help me in testing
this feature to insert and read UTF/Unicode strings? I can definitely give
it a shot.
The underlying problem I am facing that I am unable to retrieve UTF8 strings
in a table that was loaded with ASIAN characters. I am using Sybase ADO.NET
provider libraries for this purpose.

Thanks
~vc

>> I am working with a Console application and have been trying to test
>> inserting some ASIAN character strings into a back-en Sybase Database
[quoted text clipped - 6 lines]
> Do you have a way to avoid the console?
> It is very weak in dealing with Unicode.
Mihai N. - 19 Mar 2006 06:34 GMT
> Thanks for the followup. Would a .NET form application help me in testing
> this feature to insert and read UTF/Unicode strings? I can definitely give
> it a shot.
Very possible.

> The underlying problem I am facing that I am unable to retrieve UTF8 strings
> in a table that was loaded with ASIAN characters. I am using Sybase ADO.NET
> provider libraries for this purpose.
Problem is that my experience with databases is limited. I can help debug
something if I can see the results, see the code, "touch" the thing, but
not enough to know the general patterns, standard errors and such.

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

VC - 23 Mar 2006 21:31 GMT
Hi Mihai,
Thanks for the followup.
I will try to explain a bit more.
I have a back-end database (Sybase) which has a simple table with 3 fields.
(Char (50), Char(2), NVARCHAR(100))
The nvarchar is used to store ASIAN characters. While retrieving the data
from nvarchar, if is use the regular GetString() of Sybase ADO provider, I
get some string that is not the same as what I would see from a Japanese
terminal.
After I get the string (even though it does not appear to be the same as
what is in the input file) I placed it in an HTML file and opened in IE.
When i switch the encoding of the page to Japanese (Shift-JIS) or Japanese
(Auto) it renders this string back to the original form.

I am missing a step in my application, I am sure. Should i decode the data
string in my application to render it to its original form?

Is is different in MSSQL environemnt? Anything special to be done there as
well?

Thanks,
~vc
>> Thanks for the followup. Would a .NET form application help me in testing
>> this feature to insert and read UTF/Unicode strings? I can definitely
[quoted text clipped - 10 lines]
> something if I can see the results, see the code, "touch" the thing, but
> not enough to know the general patterns, standard errors and such.
Mihai N. - 27 Mar 2006 09:00 GMT
> After I get the string (even though it does not appear to be the same as
> what is in the input file) I placed it in an HTML file and opened in IE.
> When i switch the encoding of the page to Japanese (Shift-JIS) or Japanese
> (Auto) it renders this string back to the original form.
> I am missing a step in my application, I am sure. Should i decode the data
> string in my application to render it to its original form?

First, sorry for the late answer.

Sorry, but this it too vaque.

> does not appear to be the same as what is in the input file
Ok, what is the input file? What code page/encoding?
How does it get stored in DB?

> I placed it in an HTML
How? Api? Copy-paste?

> to render it to its original form?
What is the original form?

My suspicion is that one of the files is Shift-JIS and you are reading it as
UTF-8 (or the other way arround). And, on the way to HTML, you misinterpret
again the code page the oposite way, basically "fixing" the string.

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.