473,382 Members | 1,078 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,382 software developers and data experts.

Strange behaviour with UTF-8 encoding

I have 2 supposedly identical Windows 2000 web servers each with IIS5.
Both have the ASPCODEPAGE set to 65001 (utf-8) in the metabase. The
first server has been running pages like the one below for a long time
and the output has been correct ie. the ™ character and international
characters have displayed correctly (except that the ™ has never
displayed correctly in the titlebar). My problem is that the second
server is not displaying these characters correctly. Here's an example
of the asp code:

************************************************** *********************
<%@ Language=VBScript%>

<%Response.CharSet = "utf-8"%>

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8;">
<TITLE>Tradename™</TITLE>

</HEAD>

<body>
Nįttśruverndarsvęši Tradename™
</body>
</HTML>
************************************************** ***********************

The ™ displays as ? and the icelandic characters are garbled. If I
choose View > Encoding > Autoselect (turn off autoselect) and then View
Encoding > Autoselect (turn on autoselect) IE6 selects Western European rather than utf-8 and the page is correct (including the titlebar).


I have discovered that if I save the asp file as UTF-8 in notepad the
characters display correctly.

Here's the strange thing.. Although existing pages on the first server
are working fine, if I create the above test page these characters are
wrong on that server too. Once again if I save it as utf-8 it works. I
have opened some of the old pages in notepad and tried File > Save As
to see what their current encoding is and it is always ANSI, which
according to the new tests I'm running, should not work..

Also, if I copy a working page from server 1 to server 2 it doesnt work
on server 2 so it can't be the encoding of the file.

So my question is why would one page with the same character, the same
charset in the page and the same file encoding be rendered differently?
Is there a configuration setting I have missed that forces ASP pages to
be encoded in utf-8?

I would appreciate your comments.

Thanks

Feb 10 '06 #1
4 2370
Ah... looks like the encoding of this page is messing with the
characters too!

The character I'm having problems with is © (the trademark symbol)
and the icelandic character set (see
http://www.icetourist.is/default.asp?cat_id=1 for an example). I
realise I can simply use the © code instead of the TM but the
icelandic is more of a problem.

Feb 10 '06 #2
I meant "™" for TM

Feb 10 '06 #3
Further info.. the code example above doesn't work on any server
because it needs to be output in a response.write to pick up the
response.charset. This still doesn't work on my second server.

************************************************** *********************

<%@ Language=VBScript%>

<%Response.CharSet = "utf-8"%>

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

<%= "<TITLE>Trademark&trade;</TITLE>"%>

</HEAD>

<body>
<%= "Trademark&trade;"%>
</body>
</HTML>
************************************************** ***********************

Feb 10 '06 #4
I finally solved this problem. Session state wasn't enabled in IIS

Properties > Home Directory > Configuration > App Options > Tick the
Enable Session State checkbox

My understanding of this is that the codepage declaration is held in
the session and if one isnt enabled it gets ignored. If anybody can
give me a better explanation Id be interested to hear.

Feb 13 '06 #5

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

Similar topics

2
by: Benoīt Dejean | last post by:
here are my locales benoit@athlon >> locale LANG=fr_FR.UTF-8 LC_CTYPE="fr_FR.UTF-8" LC_NUMERIC="fr_FR.UTF-8" LC_TIME="fr_FR.UTF-8" LC_COLLATE="fr_FR.UTF-8" LC_MONETARY="fr_FR.UTF-8"
9
by: Dominic Godin | last post by:
Hi, I have an asp page that does a lot of processing and reports it's finished by printing the word "Success". For example: <% SomeFunction(SomeVar) SomeFunction(SomeVar1) ...
4
by: Torsten Reiners | last post by:
Hi, it might be a simple solution but I do not see it. The problem is that I have the following file stored on my local harddrive. All references are URL to a remote computer. It is working,...
2
by: Juho Vuori | last post by:
Hello, I'm wondering about the following behaviour of str() with strings containing non-ASCII characters: str(u'foo') returns 'foo' as expected. str('lää') returns 'lää' as expected. ...
5
by: Hatul Shilgy | last post by:
Hi I'm facing a very strange problem here. My code looks like this if(A == null return doSomethingWith(A.b) When I run my code (in debug mode), I get a NullReferenceException -- and on...
10
by: Oscar Thornell | last post by:
Hi, I generate and temporary saves a text file to disk. Later I upload this file to Microsoft MapPoint (not so important). The file needs to be in UTF-8 encoding and I explicitly use the...
4
by: Arturo | last post by:
Hello everybody. Can someone have a look at this bit of code? Private Sub TestExcel() 'Create the Excel Application Dim xlExcel As Application = New Excel.Application xlExcel.DisplayAlerts =...
1
by: JoReiners | last post by:
Hello, I have a really strange problem. I'm unable to figure it out on my own. I parse very simple xml documents, without any check for their form. These files look very similar and are encoded...
45
by: simnav | last post by:
In the following code something strange happens ! If I keep pressed any of ALT+Arrow, keys, they are extracted two times from buffer then getch seems to stop; if I release and press again ALT+arrow...
8
by: Dox33 | last post by:
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.