Encoded chars from form post

16 views
Skip to first unread message

Fredrik Kronander

unread,
Feb 3, 2005, 1:39:02 AM2/3/05
to
Hi,

I have an application that let's the user enter text into a textbox and this
data is collected on the server and stored in a database.
The page is multilingual and sets Response.Charset to the appropiate for the
language, for example gb2312 for chinese etc. This made all texts on the page
show up alright.

However, I did not change the codepage of the page so ASP encoded the post
data sent to the server and I have got really ugly texts for certain
languages.
I have had applications before doing the same thing where the page has been
able to decode the posted characters again when redisplaying them, but in
this case I haven't been able to get anything meaningful from them.

It seems to me that the encoded text depends on the charset used when
entering the text, entering chinese characters when using iso-8859-1 gives me
character codes like Ӓ which probably would be alright to convert but chinese
text that has been entered in the gb2312 charset look like this

~{OkBrRK<R2zF7~}

Has anyone any ideas how I can get this back into proper chinese? Any help
would be really appreciated!

Best regards
Fredrik Kronander


Hans

unread,
Feb 3, 2005, 7:57:59 AM2/3/05
to
Hi!

We have an asp application which we are building in unicode support.

What we do is to add codepage=65001 (utf-8) in all asp pages (not in include
files)
<%@ Language=VBScript CodePage=65001%>

Then we add a content-header in IIS on the virtual directory we have
Customer header name: Content-Type
Customer header value: text/html; Charset=utf-8

This will force (at least modern browsers like IE, Netscape 6+) to set the
encoding to UTF-8 (which you can see if you right click in the page and
select encoding in IE). The encodings do matters when you post data to the
server. If the encoding for example is Western European and you add a
chinese character into a textbox it will be presented correct (if you have a
unicode font installed) but it will be rubbish when you post the data to the
server. If the encoding is set to utf-8 before you post the data it should
work out for you.

In our application we create the pages dynamically so there is no hardcoded
texts inside the ASP file (so the asp file in itself is not saved in utf-8
format). This may be an issue though if you insert hardcoded texts
(including for example chinese characters) inside the asp file.

We have so far no problems presenting and saving utf-8 encoded data to
Oracle (set up with UTF-8). We can mix swedish, russian, greek, japanese,
chinese in the same text and save and view the data correct. What we have a
bit problems with is to download files where the filename includes for
example swedish characters едц, japanses or chinese characters (seems to b
characters outside ascii 0-127).

Regards
/Hans


FX

unread,
Feb 3, 2005, 10:20:22 AM2/3/05
to
Hi,

Do you have an issue for the filename encoding ? We have the same
problem when we try to URLEncode filename (retreived from a
FileSystemObject) that contains special characters like éèà...

thank's

fx

"Hans" <ha...@sorry.nospam.com> a écrit dans le message de news:
uySt%23$eCFHA...@tk2msftngp13.phx.gbl...

> example swedish characters åäö, japanses or chinese characters (seems to b

Fredrik Kronander

unread,
Feb 3, 2005, 10:51:01 AM2/3/05
to
Hi Hans and thanks for your reply.

We changed to pure unicode here as soon as we found the problem and the
application works just fine, all data is stored in xmldocuments in the db so
no hardcoded texts anywhere in the ASP page.The posted data now looks just
like it should.

I do however have posted data from before the fix that I would like to
restore to their original state and I have absolutely no clue about how to do
that.

Fredrik


"Hans" wrote:

> example swedish characters åäö, japanses or chinese characters (seems to b

Reply all
Reply to author
Forward
0 new messages