On 05/01/12 14:44, Mehdi Dogguy wrote:
I was also annoyed by the same issue. I've pushed a (tentative) fix to the Git repository. (I attach the patch here for reference only).
I forgot to include a hunk in last patch. I attached the updated one.
Author: Mehdi Dogguy <me...@debian.org> Description: Correctly determine length of lines containing UTF8 characters --- a/main.ml +++ b/main.ml @@ -103,7 +103,7 @@ in let header_width = List.fold_left - (fun w line -> max (String.length line) w) + (fun w line -> max (UTF8.length line) w) 0 header in --- a/Makefile.in +++ b/Makefile.in @@ -10,6 +10,8 @@ OCAMLYACC=@OCAMLYACC@ OCAMLLEX=@OCAMLLEX@ +OCAMLC_FLAGS=-I +extlib extLib.cma + # Installation directory INSTALLDIR=@INSTALLDIR@ @@ -51,10 +53,10 @@ $(OCAMLDEP) *.ml *.mli > Depend headache: $(CMO) - ocamlc -o $@ unix.cma str.cma $^ + ocamlc -o $@ unix.cma str.cma -I +extlib extLib.cma $^ mkconfig: $(MKCONFIG.CMO) - ocamlc -o $@ unix.cma str.cma $^ + ocamlc -o $@ unix.cma str.cma -I +extlib extLib.cma $^ config_builtin.ml: config_builtin mkconfig ./mkconfig --- a/model.ml +++ b/model.ml @@ -65,7 +65,7 @@ let arg_char args ?default name = let s = arg_string args ?default name in - if String.length s = 1 then s.[0] + if UTF8.length s = 1 then s.[0] else raise (Error (sprintf "parameter %s expects a character" name)) @@ -103,7 +103,7 @@ output_string oc open_comment; output_string oc margin; output_string oc string; - output oc white 0 (max 0 (real_width - String.length string)); + output oc white 0 (max 0 (real_width - UTF8.length string)); output_string oc margin; output_string oc close_comment; output_char oc '\n' @@ -150,7 +150,7 @@ while let s = input_line ic in not (Str.string_match regexp_end s - (max 0 (String.length s - end_length))) + (max 0 (UTF8.length s - end_length))) do () done; "" end