473,409 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Encoded chars from form post

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
Jul 22 '05 #1
3 3792
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
Jul 22 '05 #2
FX
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:
uy****************@tk2msftngp13.phx.gbl...
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

Jul 22 '05 #3
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-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

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: OutsiderJustice | last post by:
Hi, Windows XP has the builtin support for other languages, for example, Chinese, from which I can create a file with the name directly encoded in Chinese, and it's not the unicode (unreadable...
8
by: wael | last post by:
hello all, i want convert w_char to UCS2 encoded (0041) this is a char encoded UCS2 please look at this http://www.unicode.org/charts/ http://www.unicode.org/ every language has a chart bye...
3
by: Supratim | last post by:
Hi, For past few weeks I am working on a function that would take encoded Unicode characters from query string of http requests and then decode them back to Unicode numbers. I have full success...
8
by: Eric Lilja | last post by:
Hello, I had what I thought was normal text-file and I needed to locate a string matching a certain pattern in that file and, if found, replace that string. I thought this would be simple but I had...
1
by: Kevin | last post by:
I'm using a MagTek check / credit card scanner to scan checks and then submit the check data to NovaInfo through their viaWarp Gateway. The NovaInfo people won't even return my emails, so I'm...
1
by: wingsforwheels | last post by:
Prior to posting a form (.asp page) to a URL, I check the parameters being passed and they are not encoded, but when the URL is served it is encoded. How can I prevent this? The code is as...
7
by: Ron Garret | last post by:
I'm writing a little HTTP server and need to parse request content that is mime-encoded. All the MIME routines in the Python standard library seem to have been subsumed into the email package,...
5
by: sniipe | last post by:
Hi, I have a problem with unicode string in Pylons templates(Mako). I will print first char from my string encoded in UTF-8 and urllib.quote(), for example string '£ukasz': ...
0
by: stefcollect | last post by:
Hi all, I am pretty new to PHP and am stuck on - what I think - is a generic string handling problem. I need to read and manipulate some HTML files and have a problem in getting some...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.