on 01-07-2015 10:55 PM
Regards.
I use:
li_file = FileOpen (ls_path + ls_file, LineMode!, Write!, LockReadWrite!, Replace!)
When i write:
ls_xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><name>QUÍMICO'
if FileWrite (li_file, ls_xml) = -1 then
MessageBox("Error", "error", StopSign!)
end if
The result is: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><name>QUICO
But if i write:
ls_xml = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><name>QUÍMICO"
The result is: <?xml version='1.0' encoding='UTF-8' standalone='yes'?><name>QUÍMICO
WHY???
In the FileOpen you could try adding encoding EncodingUTF8!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use EncodingUTF8! but show error when execute FileWrite (li_fichero, ls_xml)
The variable ls_xml have:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><comprobanteRetencion id="comprobante" version="1.0.0"><infoTributaria><ambiente>2</ambiente><tipoEmision>1</tipoEmision><razonSocial>CODEMET S.A.</razonSocial><nombreComercial>CODEMET S.A. </nombreComercial><ruc>0990785201001</ruc><claveAcceso>0501201507099078520100120030010000016751234567811</claveAcceso><codDoc>07</codDoc><estab>003</estab><ptoEmi>001</ptoEmi><secuencial>000001675</secuencial><dirMatriz>PUERTO SANTA ANA ETAPA 1 A EDIF. SOTAVENTO PISO 2 OFICINA 203</dirMatriz></infoTributaria><infoCompRetencion><fechaEmision>05/01/2015</fechaEmision><dirEstablecimiento>PUERTO SANTA ANA ETAPA 1 A EDIF. SOTAVENTO PISO 2 OFICINA 203</dirEstablecimiento><contribuyenteEspecial>00048</contribuyenteEspecial><obligadoContabilidad>SI</obligadoContabilidad><tipoIdentificacionSujetoRetenido>04</tipoIdentificacionSujetoRetenido><razonSocialSujetoRetenido>GRUPO QUÍMICO MARCOS C. LTDA. GRUQUIMAR</razonSocialSujetoRetenido><identificacionSujetoRetenido>0991315314001</identificacionSujetoRetenido><periodoFiscal>01/2015</periodoFiscal></infoCompRetencion><impuestos><impuesto><codigo>1</codigo><codigoRetencion>341</codigoRetencion><baseImponible>15.84</baseImponible><porcentajeRetener>2.00</porcentajeRetener><valorRetenido>0.32</valorRetenido><codDocSustento>01</codDocSustento><numDocSustento>001001000026856</numDocSustento><fechaEmisionDocSustento>05/01/2015</fechaEmisionDocSustento></impuesto><impuesto><codigo>2</codigo><codigoRetencion>2</codigoRetencion><baseImponible>1.90</baseImponible><porcentajeRetener>70.00</porcentajeRetener><valorRetenido>1.33</valorRetenido><codDocSustento>01</codDocSustento><numDocSustento>001001000026856</numDocSustento><fechaEmisionDocSustento>05/01/2015</fechaEmisionDocSustento></impuesto></impuestos></comprobanteRetencion>
Hi Victor;
FWIW: Have you tried the FileWiteEX ( ) method instead? I have not encountered your Unicode issue but .... I have not used the old FileWrite ( ) method in over a decade.
BTW: Since PB 10 (being Unicode) I only use EncodingUTF16LE! within my PB applications and EncodingUTF8! when sending data to external applications. Note that WindowsVista and higher is all UTF-16LE.
Regards ... Chris
Hi Victor,
I used your exact code with both FileWrite and FileWriteEx and did not see a problem. I'm using PowerBuilder 12.5.2 build 5703.
Ted Zimmerman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.