Welcome to WebmasterWorld Guest from 34.201.121.213

Forum Moderators: ocean10000

Message Too Old, No Replies

Saving foreign characters into the database

     
1:57 pm on May 17, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 4, 2006
posts:4
votes: 0


Hi

I am programming in ASP and doing bidirectional work. The problem I'm having is that when I try to save the foreign langauges characters for e.g Japanese or Hebrew, by the time it reaches the database it gets distorted. I'm using VB6 objects and SQL database and Win2000 OS
Any insight or help would be appreciated.

Ta

Nimisha

2:44 pm on May 17, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:May 11, 2001
posts:159
votes: 0


if you make the column in question a unicode (nvarchar) rather than a varchar that should work (it may look garbled in Enterprise manager but should display okay when going to a web page)
2:44 pm on May 17, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Feb 24, 2002
posts:289
votes: 0


what character sets do you use?
can the db be set to store different charsets for each entry?
hebrew charsets are the ISO-8859-8's, japanese usually is ISO-2022-JP-2
since i do not work with databases i'm not sure but the
Unicode Transform Format (UTF) might be the solution?
3:34 pm on May 17, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 4, 2006
posts:4
votes: 0


Hi!

I'm using the foll in the head of the html
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
and CodePage is set to 65001

The database fields are set to nvarchar.
Can the original text never be stored in the database?
Also at the moment it either saves it as "???????" or when I change the charset it saves it not as "??????" but for instance like this "皆様からのお"
Is this correct...how can verify?
Ta
Nimisha

5:27 pm on May 17, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Feb 24, 2002
posts:289
votes: 0


um, i think the questionmarks appear when the source contains chars that
have codes which do not fit to any char in the viewer's charset.
if the codes fit to chars in a different charset they are shown but mostly
in this different charset the codes stand for other chars so it might not
make sense...

the only way i could imagine is to use the msie for example and set the
encoding different from utf-8 or utf-16; with the packets installed that contain japanese letters for example and view those texts (would you even
know something was misspelled if you saw those letters? ;))

4:03 am on May 18, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 16, 2000
posts:122
votes: 0


Hi Nimisha,

> Is this correct...how can verify?
> 皆様からの

It appeared as Japanese text, as posted in your message, if the browser is to Shift_JIS or Japanese autodetect.

I used Japanese Win 98 and checked it with Japanese IE 5.0, English Netscape 4.79 and 6.22 The text was saved as an image. Is this what you typed? [aujp.net]

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">

Try using either of the following
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=x-sjis">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=Shift_JIS">

Are you using Japanese or English Windows 2000?

In the Asia and Pacific forum we had a discussion about issues related to displaying Japanese text [webmasterworld.com] using, utf-8 and Japanese GlobalIME on non Japanese Windows. Some info there may help.

10:20 am on May 19, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 4, 2006
posts:4
votes: 0


Hi
I used this code<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8"> and not the foll
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=x-sjis">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=Shift_JIS">

because I have to deal with different languages i.e. Japanese, Arabic , Turkish etc. Hence the charset has to be generic.
I seem to be completely stuck as I can't seem to figure out how to verify what is saved in the database. I could give it a try by setting the charset to utf-16.
Hope anyway of you could help me out as it's very frustrating not being able to continue...
appreciate all the help.
Ta
Nimisha

11:06 am on May 19, 2002 (gmt 0)

Full Member

10+ Year Member

joined:Feb 24, 2002
posts:289
votes: 0


since utf contains the code for any char (http://www.unicode.org/charts/)
there must be a way to configure the app you view the stored data with.
or is it possible to access the db using some other app that one can
configure to display japanese/hebrew charsets?
2:31 pm on May 19, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 4, 2006
posts:4
votes: 0


Hi!
Somebody outside this forum mentioned that the foreign characters will be stored as for instance "#1234" etc. Does that mean I could never verify my text looking at the records in the database and probably should have to test it by having another asp which should display the input correctly.
Any ideas?
Ta
11:39 am on May 21, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 4, 2006
posts:4
votes: 0


Hi
Got it working guys..thanks for all the input
11:58 am on May 21, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 21, 2002
posts:73
votes: 0


I'm using hebrew in my Access DB and i do it using:

<%@LANGUAGE="VBSCRIPT" codepage=1255%>

at the top of all my pages.

it fix all the "???????" problem.

Morrison.

12:27 pm on May 21, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 6, 2001
posts:917
votes: 0


Nimisha...can you tell us how you got it working...it's the sort of problem I keep getting landed with...so reading other people's solution amy be very useful
12:38 pm on May 21, 2002 (gmt 0)

New User

10+ Year Member

joined:Oct 4, 2006
posts:4
votes: 0


Hi Eric

1)I first set the codepage fpor each aspage to the codepage for the language you want to display i.e. if it is Arabic set the codepage to =1256.
2)Then I set the meta tag in the html to
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" >.
3)In the insert statement of the sql I prefix the text being passed into the field of the database with an "N" for e.g "INSERT INTO tblName () VALUES (N'""')"
4)Finally to see what has been saved into the database, do a Response.BinaryWrite Server.HTMLEncode(Text) in the asp.
IN the database it gets saved either as square blocks in the case of Japanese or correctly in the case of Arabic.
Hope that helps everyone out there...I did struggle a bit to get it all tuned and working but thank you everyone for you suggestions...Hope this helps
Ta
Nimisha