[Mono-list] Web Services encoding

Cedric Marcone marcone@mdeo.fr
Fri, 11 Mar 2005 15:16:25 +0100


Hi all,

I've got a question that sounds silly but as I couldn't find any
pointers here it is :

"How to change the response encoding for Web Services ?"

Objects seems to be serialized to XML using "us-ascii" encoding : 
<?xml version="1.0" encoding="us-ascii"?>

-> This leads to broken characters (replaced by question marks)

Moreover, I don't understand why the response header specifies that
utf-8 is being used.
Content-Type: text/xml; charset=utf-8


-> Here's a summary of a conversation as captured by ethereal :

* Request :

GET /mono/Movies.asmx/GetGenres HTTP/1.1
Host: monster.mdeo.net
User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.7.5)
Gecko/20050221 Firefox/1.0 (Ubuntu) (Ubuntu package 1.0+dfsg.1-6ubuntu1)
Accept: text/xml,application/xml,application/xhtml
+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive


* Response :Thank you for your answers

HTTP/1.1 200 OK
Date: Fri, 11 Mar 2005 13:50:59 GMT
Server: Apache/1.3.33 (Debian GNU/Linux) mod_mono/1.0
X-Powered-By: Mono
Transfer-Encoding: chunked
Keep-Alive: timeout=15, max=94
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8

46f
<?xml version="1.0" encoding="us-ascii"?>
<ArrayOfGenre xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://monster.mdeo.net">
  <Genre>
    <id>1</id>
    <name>Com?die</name>
  </Genre>
  [...]
</ArrayOfGenre>
0

By the way, I'm using mono from Ubuntu Hoary (1.0.5)

Thank you for your answers,
--
Cédric