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