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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

iconv encoding conversion

  • 27-09-2006 3:27pm
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 1,473 ✭✭✭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