[xml] RE: Hello!. About encoding



Hello again,

Sorry, I´ve just reached it, this is the code:

char *convert(unsigned char *in){
  unsigned char *out;
  int size, out_size, temp;
  xmlCharEncodingHandlerPtr handler;

  size=(int)strlen(in)+1;
  out_size=size*2-1;
  out=malloc((size_t)out_size);
  temp=size-1;

  UTF8Toisolat1(out, &out_size, in, &temp);
  return(out);
}

So I just need to call this function whenever I need
ISO-8859-1 formatted data from within the markup file.

Isn´t it that amazing?

Thanks very much, 

Kind Regards,


 --- a b <acptsys yahoo es> escribió:

Hello everybody!,

I´m trying to use libxml2 to parse driving-tests
written in Spanish (ISO-8859-1), to an ncurses app
written in C.

Because of trying to do something that´s gonna be
easy
to use for the final user, I´ve just avoided the use
of name-spaces, leaving my xml-file like this:

<question>
 <title>some spanish text</title>
 <option>some option</option>
 <correct-option>some other option</correct-option>
</question>

Oviously, when trying to parse this file back to the
app., I don´t get proper spanish´ punctuation marks
as
cutes, tildes, etc.

I´ve been trying to reuse some source-code from
examples that came with my libxml2-2.2.69, like
testWriter.c, but it always returns me a: conversion
unsuccesful!.

So, since I´m not a proper programmer, and you api
specs seems quite complicated to me, I haven´t got
and
haven´t seen anywhere from where to start doing
this,
at the time that I´m asking myself this questions:

If I have a xml file with ISO-8859-1 characters (not
at node-name level), when I parse this file, libxml2
will translate them to utf-8, but will do it
correctly?, I mean.

If I just apply something like utf8toLatin1 just
within the output is ok?

Is there any working example that I could look at,
so
I   could reuse this code?

Thanks very much, and sorry because of my english.

Kind Regards,



      
      
              
______________________________________________ 
Renovamos el Correo Yahoo! 
Nuevos servicios, más seguridad 
http://correo.yahoo.es




                
______________________________________________ 
Renovamos el Correo Yahoo! 
Nuevos servicios, más seguridad 
http://correo.yahoo.es



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]