Encoding change

Discussion in 'XML' started by Kiran, Jan 8, 2005.

  1. Kiran

    Kiran Guest

    Hi All,
    I have a xml file with UTF-8 encoding it has some chineese data values
    also. I wanted to change it to other encodings like UTF-16 ,GBK etc. I
    used iconv utility in Unix for this ..but was not successful . Can
    anybody provide some help regarding this ?.

    Thanks,

    Kiran Nair
     
    Kiran, Jan 8, 2005
    #1
    1. Advertising

  2. Kiran wrote:
    > I have a xml file with UTF-8 encoding it has some chineese data values
    > also. I wanted to change it to other encodings like UTF-16 ,GBK etc. I
    > used iconv utility in Unix for this ..but was not successful . Can
    > anybody provide some help regarding this ?.


    Not successful in what way? Did iconv fail, or was the output incorrect?

    You can transcode the file with a fairly simple XSLT transformation
    using your favorite XSLT processor, essentially specifying a different
    output encoding and copying everything from the source document:

    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:eek:utput encoding="utf-16" />
    <xsl:template match="node()|@*">
    <xsl:copy>
    <xsl:apply-templates select="node()|@*" />
    </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>


    --
    Klaus Johannes Rusch

    http://www.atmedia.net/KlausRusch/
     
    Klaus Johannes Rusch, Jan 8, 2005
    #2
    1. Advertising

  3. Kiran

    Kiran Guest

    Thanks Klaus .

    I will try this . Yes iconv did not give any results ..

    How do I check that the output file that I have got is of what encoding
    ?
     
    Kiran, Jan 8, 2005
    #3
  4. Kiran wrote:

    > I will try this . Yes iconv did not give any results ..


    I cant believe this. Write a "Hello World!"
    text file and try to use iconv on it. If
    iconv really produces nothing, you should
    post a bug report.

    Could it be that you converted to utf-16
    and tried to read the result as a C-string ?
     
    =?ISO-8859-1?Q?J=FCrgen_Kahrs?=, Jan 8, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hardy Wang

    Encoding.Default and Encoding.UTF8

    Hardy Wang, Jun 8, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    19,047
    Jon Skeet [C# MVP]
    Jun 9, 2004
  2. Ahan Hsieh

    How to change the encoding in JSP?

    Ahan Hsieh, Jul 24, 2003, in forum: Java
    Replies:
    1
    Views:
    5,250
    Manish Jethani
    Jul 24, 2003
  3. Replies:
    1
    Views:
    23,570
    Real Gagnon
    Oct 8, 2004
  4. Jack Andersson
    Replies:
    0
    Views:
    399
    Jack Andersson
    Nov 24, 2004
  5. Replies:
    2
    Views:
    418
Loading...

Share This Page