mlenc is a encoding conversion package using mlang.dll. It is similer to Tcl's encoding command. It requires mlang.dll which is included in InternetExplorer.

Sample

% package require mlenc
0.1
% mlenc::encoding names
1200 1201 1250 1251 1252 1253 1254 1255 1256 1257 1258 20866 
21866 28592 28593 28594 28595 28596 28597 28598 38598 50000 
50001 50220 50221 50222 50225 50932 50949 51932 51949 52936
65000 65001 708 720 852 862 866 874 932 936 949 950
% set bin [mlenc::encoding convertto 51932 内田百閒]
?????´??
% puts [encoding convertfrom euc-jp $bin]
内田百?
% puts [mlenc::encoding convertfrom x-euc-jp $bin]
内田百閒

x-euc-jp is an alias name of 51932. And I trid to _autodetect to recognize an encoding of $bin, but It failed. I think that $bin is too short to be recognized. I also created the 51932 encoding, see cp51932.enc.

Speed

Slow... Tcl's encoding command is far faster than mlenc...

% set fp [open ~/test.txt r]
file91ffe0
% set str [read $fp]
...
% string length $str
14603
% time {mlenc::encoding convertto 932 $str} 100
10999.11 microseconds per iteration
% time {encoding convertto cp932 $str} 100
2312.25 microseconds per iteration

License

BSD Style

Download

Comment



CategoryTclTk CategoryEnglish


|New|Edit|Freeze|Diff|Backup|Attach|Copy|Rename|
Last-modified: 2007-06-08 (Fri) 19:11:40 (4059d)
HTML convert time: 0.023 sec.