mldonkey-commits
[Top][All Lists]
Advanced

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

[Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/networks/bittorr...
Date: Sat, 23 Sep 2006 22:35:12 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/09/23 22:35:12

Modified files:
        distrib        : ChangeLog 
        src/networks/bittorrent: bTGlobals.ml bTInteractive.ml 
        src/utils/lib  : charset.ml charset.mli 

Log message:
        patch #5405

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1024&r2=1.1025
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTGlobals.ml?cvsroot=mldonkey&r1=1.65&r2=1.66
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/networks/bittorrent/bTInteractive.ml?cvsroot=mldonkey&r1=1.110&r2=1.111
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/charset.ml?cvsroot=mldonkey&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/lib/charset.mli?cvsroot=mldonkey&r1=1.3&r2=1.4

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1024
retrieving revision 1.1025
diff -u -b -r1.1024 -r1.1025
--- distrib/ChangeLog   23 Sep 2006 22:28:58 -0000      1.1024
+++ distrib/ChangeLog   23 Sep 2006 22:35:12 -0000      1.1025
@@ -15,6 +15,7 @@
 =========
 
 2006/09/24
+5405: BT: Use field "encoding" from .torrent to convert strings to UTF-8
 5419: EDK: Remove titanesel.ws links
 5418: Gnutella/G2/Fasttrack: Support client_bind_addr
 5417: Edonkey comments: Telnet support, UTF-8 output in HTML

Index: src/networks/bittorrent/bTGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTGlobals.ml,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- src/networks/bittorrent/bTGlobals.ml        23 Sep 2006 20:29:47 -0000      
1.65
+++ src/networks/bittorrent/bTGlobals.ml        23 Sep 2006 22:35:12 -0000      
1.66
@@ -233,7 +233,7 @@
           file_file = file_impl;
           file_piece_size = t.torrent_piece_size;
           file_id = file_id;
-          file_name = t.torrent_name;
+          file_name = Charset.safe_convert t.torrent_encoding t.torrent_name;
           file_comment = t.torrent_comment;
           file_created_by = t.torrent_created_by;
           file_creation_date = t.torrent_creation_date;

Index: src/networks/bittorrent/bTInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/networks/bittorrent/bTInteractive.ml,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -b -r1.110 -r1.111
--- src/networks/bittorrent/bTInteractive.ml    23 Sep 2006 20:29:47 -0000      
1.110
+++ src/networks/bittorrent/bTInteractive.ml    23 Sep 2006 22:35:12 -0000      
1.111
@@ -130,7 +130,7 @@
   Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr 
());
   html_mods_td buf [
     ("Filename", "sr br", "Filename");
-    ("", "sr", file.file_name) ];
+    ("", "sr", (Charset.safe_convert file.file_encoding file.file_name)) ];
 
   Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr 
());
   html_mods_td buf [
@@ -158,7 +158,7 @@
 
   html_mods_td buf [
     ("Torrent Filename", "sr br", "Torrent Fname");
-    ("", "sr", file.file_torrent_diskname) ];
+    ("", "sr", (Charset.safe_convert file.file_encoding 
file.file_torrent_diskname)) ];
 
   Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr 
());
 
@@ -166,14 +166,14 @@
     ("Comment", "sr br", "Comment");
     ("", "sr", match file.file_comment with
         "" -> "-"
-      | _ -> file.file_comment) ];
+      | _ -> (Charset.safe_convert file.file_encoding file.file_comment)) ];
 
   Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr 
());
   html_mods_td buf [
     ("Created by", "sr br", "Created by");
     ("", "sr", match file.file_created_by with
         "" -> "-"
-      | _ -> file.file_created_by) ];
+      | _ -> (Charset.safe_convert file.file_encoding file.file_created_by)) ];
 
   Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr 
());
   html_mods_td buf [
@@ -185,7 +185,7 @@
     ("Modified by", "sr br", "Modified by");
     ("", "sr", match file.file_modified_by with
         "" -> "-"
-      | _ -> file.file_modified_by) ];
+      | _ -> (Charset.safe_convert file.file_encoding file.file_modified_by)) 
];
 
   Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr 
());
   html_mods_td buf [

Index: src/utils/lib/charset.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/charset.ml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- src/utils/lib/charset.ml    14 Sep 2006 17:40:29 -0000      1.7
+++ src/utils/lib/charset.ml    23 Sep 2006 22:35:12 -0000      1.8
@@ -172,7 +172,7 @@
 
(**********************************************************************************)
 
 (* taken from camomile *)
-(* $Id: charset.ml,v 1.7 2006/09/14 17:40:29 spiralvoice Exp $ *)
+(* $Id: charset.ml,v 1.8 2006/09/23 22:35:12 spiralvoice Exp $ *)
 (* Copyright 2002, 2003 Yamagata Yoriyuki. distributed with LGPL *)
 
 let utf8_look s i =
@@ -254,7 +254,7 @@
 
(**********************************************************************************)
 
 (* taken from camomile *)
-(* $Id: charset.ml,v 1.7 2006/09/14 17:40:29 spiralvoice Exp $ *)
+(* $Id: charset.ml,v 1.8 2006/09/23 22:35:12 spiralvoice Exp $ *)
 (* Copyright 2002, 2003 Yamagata Yoriyuki. distributed with LGPL *)
 
 let rec length_aux s c i =
@@ -281,7 +281,7 @@
 
 
 (* taken from camomile *)
-(* $Id: charset.ml,v 1.7 2006/09/14 17:40:29 spiralvoice Exp $ *)
+(* $Id: charset.ml,v 1.8 2006/09/23 22:35:12 spiralvoice Exp $ *)
 (* Copyright 2002, 2003 Yamagata Yoriyuki. distributed with LGPL *)
 
 external uint_code : uchar -> int = "%identity"
@@ -1817,6 +1817,17 @@
     convert_string s t f
   end else s
 
+let safe_convert enc s =
+  match enc with
+    "" -> s
+  | enc ->
+    try
+      convert
+        ~from_charset: (charset_from_string enc)
+        ~to_charset: (charset_from_string "UTF-8")
+        s
+    with _ -> s
+
 
(**********************************************************************************)
 (*                                                                             
   *)
 (*                          slow_encode_from_utf8                              
   *)

Index: src/utils/lib/charset.mli
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/lib/charset.mli,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/utils/lib/charset.mli   1 Aug 2005 20:09:13 -0000       1.3
+++ src/utils/lib/charset.mli   23 Sep 2006 22:35:12 -0000      1.4
@@ -141,6 +141,7 @@
 (** [convert ~from_charset ~to_charset s]
     raise CharsetError if the string s is not entirely convertible. *)
 val convert : from_charset : charset -> to_charset : charset -> string -> 
string
+val safe_convert: string -> string -> string
 
 (** [is_utf8 s]
     returns TRUE if s is a valid UTF-8, otherwise returns FALSE.




reply via email to

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