Friday, April 3, 2009

Forcing charset on content on the web

I hit a snag today. I needed to use the ?OpenField-command in an Ajax application to fetch utf-8 encoded content. The content seemed to be sent as ISO-8859-1. I believe the browser read it as UTF-8, which resulted in all the norwegian characters not showing correctly.

The Domino team already thought about this way back in N/D 5.02 (according to the help-file). Back then, they added a charset parameter that tells the server which charset it should send the content in. The charset parameter seems to work more or less in any context.

E.g.
http://domain.com/db.nsf/byid/someid/body_field?OpenField&charset=utf-8

0 comments: