Groups | Blog | Home
all groups > dotnet internationalization > april 2006 >

dotnet internationalization : How are UTF-8 data received at IIS?


Chris Y
4/20/2006 12:00:00 AM
I have a <INPUT NAME=3D'name'> on a FORM and page charset is set to =
UTF-8.

I entered and submitted these characters: =
=C2=A9=E6=AF=9B=E6=B3=BD=E4=B8=9C. (Hope you can see them.)

On the ACTION page, I have the following code:


-------------------------------------------------------------------------=
-------

<%
Dim Name,X,i
Name=3Drequest.Form("name")
X=3D"ASCII"
for i=3D1 to Len(Name)
X=3DX & ":" & AscW(mid(Name,i,1))
next
%>
<%=3DName%>
<%=3DX%>


-------------------------------------------------------------------------=
-------


The first line shows the expected output: =
=C2=A9=E6=AF=9B=E6=B3=BD=E4=B8=9C
The second line shows: =
ASCII:194:169:230:175:8250:230:179:189:228:184:339=20

First character: good 194:169 is the copyright symbol
Second character: no good. What is the number 8250!
Third character: good 230:179:189 is the UTF-8 encoding for =E6=B3=BD
Fourth character: no good. What is 339!

I capture the downloaded page in binary and the first line bytes are =
actually (hexadecimal):
C2 A9 E6 AF 9B E6 B3 BD E4 B8 9C.

Why does AscW produce different results from the string at certain =
bytes? This problem makes the data unuseable. I get the same results =
on two different IIS machines. What have I done wrong?

Any help will be greatly appreciated.

Tony Zhou
4/22/2006 12:00:00 AM
It seems that you are writing an ASP application.
Can you give us your OS language version and ASP source code?
It will help if we understand much more about the background and the detail.

Gook luck.

[quoted text, click to view]
Chris Y
4/22/2006 12:00:00 AM
Thanks. I am on Windows Server 2003, but my development tool is
notepad.exe! My source code is all that is in the message below. And that
was the problem. I am sure you can recreate it by copying and pasting the
code shown.

After more testing I found that again it was my negligence. I did not force
the code page to 65001. The moment I did that, AscW on the server behaves
correctly.


[quoted text, click to view]

AddThis Social Bookmark Button