Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Mar : libxml2 DLL
| Subject: | libxml2 DLL |
| Posted by: | "Carlos Matos" (mat..@comograma.pt) |
| Date: | Mon, 17 Mar 2008 17:19:09 |
I'm libxml2 to create a XML file but I need to encode this file with another
charset, ISO-8859-1.
I know that libxml2 need input in UTF-8, so I must convert from from
ISO-8859-1 (my XML encoding),
to UTF-8. For that I'm using iconv_open(), _iconv() and iconv_close function
(iconv.dll).
My code is:
var
P: iconv_t;
S: String;
I, O: PAnsiChar;
Len1, Len2: Cardinal;
begin
P := iconv_open('windows-1252', 'UTF-8');
S := 'Conservatória do registo comercial de Lisboa/Registo comercial nº
15500';
StrPCopy(I, S);
Len1 := Length(I);
Len2 := 2 * Len1;
// When I execute this line, I get an access violation saying: Access
violation at address 00558B81 in module 'libiconv.dll'. Write of address
01000000.
_iconv(P, I, Len1, O, Len2);
iconv_close(P);
end;
So, what I am missing? I can't get it to work.
Thanks,
Carlos