mldonkey-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-users] [patch #5123] Fix Invalid_argument("UTF8.length") bug i


From: su_blanc
Subject: [Mldonkey-users] [patch #5123] Fix Invalid_argument("UTF8.length") bug in HTML, down-/uploaders
Date: Thu, 25 May 2006 06:10:16 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Avant Browser; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727; WinFX RunTime 3.0.50727)

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/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]