method of_utf8 s =
      match encoding with
        None -> Ed_misc.of_utf8 s
      | Some coding -> Ed_misc.of_utf8 ~coding s