I guess I figured this is more the question I'm looking for. I hope at least

i got this String declared within Java

input = "||3.2|2013-01-25T17:24:00|ingreso|PAGO EN UNA SOLA EXHIBICION|6386.21|MXN|7408.00|No identificado|NAUCALPAN DE JUÁREZ, ESTADO DE MEXICO|CAOS640116HT5|OSCAR MARTIN CARRERA|CTO. ORADORES 33|33|CD. SATELITE|NAUCALPAN DE JUÁREZ|ESTADO DE MEXICO|MÉXICO|53100|CTO. ORADORES 33|33|CD. SATELITE|NAUCALPAN DE JUÁREZ|ESTADO DE MEXICO|MÉXICO|53100|Persona Física con Actividad Empresarial|BAÑ930616R66|BAÑOMOBIL, S.A. DE C.V.|Av. 1° de Mayo|197|San. Lorenzo|TLALNEPANTLA DE BAZ|ESTADO DE MEXICO|MÉXICO|54047|1|NO APLICA|Dominio .com|Dominio por 1 año www.sanitariosportatiles.com|586.21|586.21|1|NO APLICA|Hospedaje 2 Gb|Hospedaje 2 Gb por 1 año www.sanitariosportatiles.com|5800.00|5800.00|IVA|16.00|1021.79|1021.79||";

Is it possible to convert it to ISO-8859-1 and then to UTF-8? Is it pointless to convert it to ISO-8859-1 first?

Basically, all I need is to have that String in utf8 bytes and I don't know if because some characters come from ISO-8859-1 I have to convert it to that first, then to UTF-8 or what would be the proper procedure to achieve it.

有帮助吗?

解决方案

No, you don't need two steps.

You can simply use:

byte[] utf8bytes = input.getBytes("UTF-8");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top