Follow-up Comment #2, patch #5123 (project mldonkey):

Hi Spiralvoice,

Why checking utf8_length of 'str'. You are not sure that 'str' is utf8
encoded. Only 'name' is utf8 encoded, so it won't raise any error if you
proceed like this:

let shorten str limit =
 (* TODO: we should change all strings to utf8 when
    they come into the core instead. *)
 let name = Charset.to_utf8 (* String.escaped *) str in
 let len = Charset.utf8_length name in
 let max_len = maxi limit 10 in
 if len > max_len then
   let prefix = String.sub name 0 (max_len - 7) in

just a proposal...
regards

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?func=detailitem&item_id=5123>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/



_______________________________________________
Mldonkey-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/mldonkey-users

Reply via email to