jed-users mailing list

[2008 Date Index] [2008 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

RE: iconv module documentation or examples?


> -----Original Message-----
> From: Marko Mahnic
> Sent: martedì 26 agosto 2008 9.12
> Subject: Re: iconv module documentation or examples?
> 
> G. Milde wrote:
> > Unfortunately, I could not find any documentation or 
> > examples on how to use
> > the functions provided by the iconv module. Does anyone 
> > have experience or
> > working examples on how to convert a buffer or a string 
> > using the iconv
> > module?
> > 
> 
> A while ago Dino created a wjed version that includes iconv, but not
> as a module. There is also a charset module that should convert
> any loaded file into UTF on load and the reverse on save.
> 
>    http://www.paneura.com/~dino/wjed.html
> 
> Marko

Hi Jedders, 

While I'm very very busy both at work (my company has been merged with
another) and at home (I have a baby to play with, so no more free time to
hack Jed), I took a little bit of time to write a simple script using the
iconv module. This is an 'iconv' command line program implementation in
Slang, and tries to be compatible with the iconv program present in almost
all linux distributions.

Using is very simple: run it as 

slsh testiconv.sl -f encoding_in -t encoding_out [filein] [fileout]

Playing a bit with this script, I found that iconv-module is missing an
important detail: it needs to handle incomplete multibyte sequences. This is
not a problem for 'charset.sl', as it converts full lines (and you can't end
a line with an incomplete character), but for a more general use (as in
'testiconv.sl'), you cannot split input in lines (e.g. You can't try to find
the newline character, as it depends on the input character set).

The attached patch implements the missing incomplete multibyte handling file
(iconv-module-multibyte.diff).

John, could you apply this patch? Also, I would like to have the
'testiconv.sl' script added to the 'slsh/scripts' directory in the Slang
repository (maybe renamed simply to 'iconv').

BTW, I still think that always working in UTF-8, and converting when loading
or saving files. A detailed conversation about this can be found on message
http://ruptured-duck.com/jed-users/msg01836.html, and other messages linked
there. There is also an attachment containing my 'charset.sl' script, this
may be useful as extracting the files from a windows installer my not be so
easy.

Hope this helps,

Dino



Attachment: testiconv.sl
Description: Binary data

Attachment: iconv-module-multibyte.diff
Description: Binary data


[2008 date index] [2008 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]