Version française
Home     About     Download     Resources     Contact us    
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 <Romain.Bardou@lri.fr> 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:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

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:
    http://caml.inria.fr/pub/docs/manual-ocaml/manual029.html#toc112
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 =
  object
    initializer
       character_encoding <-
       "<meta content=\"text/html; charset=\"UTF-8\" http-equiv=\"Content-Type\">\n"
  end

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                             http://yquem.inria.fr/~guesdon/
Service Expérimentation et Développements         https://sed-roc.inria.fr/
INRIA Paris-Rocquencourt                  http://www.inria.fr/rocquencourt/