salut je débarque
mon pb est déjà résolu mais j'ai pas compris pourquoi !
si qqn peut m'aider a elucider ce mystere...
soit "row" une String encodée en UTF-8
je veux l'afficher dans la sortie std sans pb d'accents
=> marche pasCode:System.out.println(new String(row.getBytes(),"ISO-8859-1"));
(pourtant, cette solution vient de ce forum)
=> marche pas non plusCode:System.out.println(new String(row.getBytes("UTF-8"),"ISO-8859-1"));
=> marche !Code:System.out.println(new String(row.getBytes("ISO-8859-1"),"UTF-8"));
=> marche pasCode:System.out.println(new String(row.getBytes("ISO-8859-1")));
javadoc String dit :
1)
=> ok, cela justifie "getBytes("ISO-8859-1")"Citation:
public byte[] getBytes(String charsetName)
throws UnsupportedEncodingException
Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array.
2)
=> pourquoi diable a-t-on besoin de cela puisque la chaine est deja réencodée avec getBytes("ISO-8859-1") ?Citation:
public String(byte[] bytes,
String charsetName)
throws UnsupportedEncodingException
Constructs a new String by decoding the specified array of bytes using the specified charset.
chui paumé
ce doit etre la fatigue
desolé d'avance si c le k
;)