[Mono-list] UTF8 Encoding

James Grant topace@lightbox.org
Wed, 16 Feb 2005 10:56:20 -0500


Hi all (yup second post in as many days)...

I can live with starting mono manually (instead of having mod_mono start it=
=20
automatically when needed)... so now my problem is with character encodings.

=46irst, i'll give you a brief synopsis of the files im using:

http://test.lightbox.ca/index.aspx  <- this file basically has some UTF-8=20
Encoded characters (the french "c"), nothing out of the ordinary

=2D-----------------index.aspx---------------------
<html><body>
<br>
UTF-8: Fran=C3=A7ais
<br>
WINDOWS-1252: Fran=E7ais
<br>

<asp:hyperlink id=3D"frenchlink" style=3D"Z-INDEX: 1; LEFT: 300; POSITION:=
=20
absolute; TOP: 30" runat=3D"server"=20
NavigateUrl=3D"index.aspx">Fran=C3=A7ais</asp:hyperlink>
</body>
</html>
=2D------------------------------------------------

and also, my (very stripped down to find the problem) web.config looks like=
=20
this:

=2D--------------web.config--------------------------
<?xml version=3D"1.0" encoding=3D"utf-8" ?>
<configuration>
  <system.web>
    <compilation=20
         defaultLanguage=3D"c#"
         debug=3D"true"
    />

    <!-- GLOBALIZATION
          This section sets the globalization settings of the application.=
=20
          -->
    <globalization=20
            requestEncoding=3D"utf-8"=20
            responseEncoding=3D"utf-8"=20
   />

 </system.web>
</configuration>
=2D-------------------------------------------------

in this current web.config configuration, you'll notice that the=20
request/response Encodings are set to "utf-8" .. all fine and dandy till yo=
u=20
view the page and instead of showing the UTF-8 character, it shows ??=20
instead.

Now, if you comment out / remove the <globalization ..... > tag, restart mo=
no,=20
and view the page, the UTF-8 encoded character works perfectly.

So, I guess my question is... am I using the <globalization ...> tag wrong?=
=20
somehow setting the encodings to UTF8 causes it _not_ to work, whereas=20
leaving it 'undefined' (not something i really want to do) allows utf8 to=20
work properly.

=46eel free to access the above http://test.lightbox.ca/index.aspx  ... i w=
ill=20
leave it with the web.config setting the encodings to utf8 so you can see i=
t=20
not work.

Any help would be appreciated... and yes, the obvious solution is "dont set=
=20
the encodings if that works" ... but im just trying to get to the bottom of=
=20
things, to see WHY its not working :)

(ps, the webserver virtualhost sets the defaultcharset to utf8, as per:
        AddDefaultCharset UTF-8
)

Cheers,
  James

=2D-=20
James Grant
Lightbox Technologies Inc.
http://www.lightbox.org
613-294-3670