Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Ocamldoc and Unicode characters
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Maxence Guesdon <Maxence.Guesdon@i...>
Subject: Re: [Caml-list] Ocamldoc and Unicode characters
On Thu, 03 Jun 2010 15:04:42 +0200
Romain Bardou <> wrote:

> Hello,
> If I put some unicode characters inside an ocamldoc comment, it is 
> copied as is, but the browser does not print them correctly because the 
> page header does not say that the page is encoded using unicode.
> Is there a way I can change the header of the generated pages 
> automatically to change the encoding information?
> Thanks,
> -- 
> Romain Bardou
> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports:

I see two easy solutions:

1. Something like
  sed 's:iso-8859-1:UTF-8:'
 on each ocamldoc-generated html file

2. or create and use your own ocamldoc-generator as explained here:
In this generator, just set the character_encoding field something else
than the default which is
 "<meta content=\"text/html; charset=\"iso-8859-1\" http-equiv=\"Content-Type\">\n"

Somehting like the following code should to the trick:
class my_doc_gen =
       character_encoding <-
       "<meta content=\"text/html; charset=\"UTF-8\" http-equiv=\"Content-Type\">\n"

let my_generator = new my_doc_gen
let _ = Odoc_args.set_doc_generator (my_generator :> Odoc_args.doc_generator)

(code not tested)

Hope this helps,

Maxence Guesdon                   
Service Expérimentation et Développements
INRIA Paris-Rocquencourt