Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Encoded chars from form post

Reply
Thread Tools

Encoded chars from form post

 
 
Fredrik Kronander
Guest
Posts: n/a
 
      02-03-2005
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


 
Reply With Quote
 
 
 
 
Hans
Guest
Posts: n/a
 
      02-03-2005
Hi!

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

What we do is to add codepage=65001 (utf- 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-. 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


 
Reply With Quote
 
 
 
 
FX
Guest
Posts: n/a
 
      02-03-2005
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" <(E-Mail Removed)> a crit dans le message de news:
uySt%23$(E-Mail Removed)...
> Hi!
>
> We have an asp application which we are building in unicode support.
>
> What we do is to add codepage=65001 (utf- 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-. 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
>
>



 
Reply With Quote
 
Fredrik Kronander
Guest
Posts: n/a
 
      02-03-2005
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:

> Hi!
>
> We have an asp application which we are building in unicode support.
>
> What we do is to add codepage=65001 (utf- 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-. 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
>
>
>

 
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
How to truncate char string fromt beginning and replace chars instring by other chars in C or C++? Hongyu C++ 9 08-08-2008 12:18 PM
Floats to chars and chars to floats Kosio C Programming 44 09-23-2005 09:49 AM
receiving ??? chars instead of "special" chars M.Posseth ASP .Net Web Services 3 11-16-2004 07:00 PM
http.post() problem only when using base64-encoded data Randy Lawrence Ruby 2 07-04-2004 08:41 PM
http.post problems with base64 encoded data Randy Lawrence Ruby 0 07-04-2004 07:40 PM



Advertisments