Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

iconv encoding conversion

Options
  • 27-09-2006 4:27pm
    #1
    Registered Users Posts: 90 ✭✭


    Hi,

    I'm trying to read data in from two files, but I'm not sure what encoding they use. Both are Japanese text, and when I open them up in firefox and check under View - Character Encoding, one supposedly uses 'UTF-8' and the other 'SHIFT_JIS'.

    Now I want both files (utf8File and shiftJISFile) to be encoded in SHIFT_JIS, so started up a prompt in unix and typed:

    iconv -f UTF-8 -t SHIFT_JIS utf8File > shiftJISFile

    The iconv command, should convert a file from one encoding set into antother, but I end up getting the error:
    iconv: illegal input sequence at position 0. This leads me to believe that Firefox has misinterpreted the file as being 'UTF-8'.

    Are there any clear ways of determining the encoding of a file, or does anyone know of another program to convert encodings?

    Thanks


Comments

  • Registered Users Posts: 26 ast


    In the past I have found this very useful for this kind of work.

    http://www.babelstone.co.uk/Software/BabelPad.html


  • Registered Users Posts: 1,472 ✭✭✭tred


    Hi,

    I'm trying to read data in from two files, but I'm not sure what encoding they use. Both are Japanese text, and when I open them up in firefox and check under View - Character Encoding, one supposedly uses 'UTF-8' and the other 'SHIFT_JIS'.

    Now I want both files (utf8File and shiftJISFile) to be encoded in SHIFT_JIS, so started up a prompt in unix and typed:

    iconv -f UTF-8 -t SHIFT_JIS utf8File > shiftJISFile

    The iconv command, should convert a file from one encoding set into antother, but I end up getting the error:
    iconv: illegal input sequence at position 0. This leads me to believe that Firefox has misinterpreted the file as being 'UTF-8'.

    Are there any clear ways of determining the encoding of a file, or does anyone know of another program to convert encodings?

    Thanks

    cat $FTMP | /usr/bin/iconv -f $INCODE -t $OUTCODE 2>/dev/null > $FTMP.jis

    i think u need to pass in an extra parameter after the file for null. This works for me fine.


Advertisement