내 오류 : "1 바이트 UTF-8 시퀀스의 잘못된 바이트 1"입니다."1 바이트 UTF-8 시퀀스의 잘못된 바이트 1"오류
Blaze DS를 사용하여 Java 메소드를 호출 중입니다.
내 오류 : "1 바이트 UTF-8 시퀀스의 잘못된 바이트 1"입니다."1 바이트 UTF-8 시퀀스의 잘못된 바이트 1"오류
Blaze DS를 사용하여 Java 메소드를 호출 중입니다.
하이 니티는 "원격-config.xml에"대상 ID와 소스 이름이 올바른지 확인하십시오.
질문에 세부 사항이 충분하지 않습니다.
내 추측으로는 은 UTF-8로 인코딩 된 내용을 읽는 중이고 UTF-8로 인코딩되지 않은 것 같습니다.
XML 문서에는 Windows 프로그램으로 작성 되었기 때문에 BOM 표식이 있습니다.
Java는이 상자를 지원하지 않습니다. 그러니 http://www.unicode.org/faq/utf_bom.html
, 또는 당신의 InputStream이 같은 사용 무언가 (그것이 당신의 DS 설정 파일 인 경우) XML 문서가 어떤 BOM 마커가 없습니다 있는지 확인하십시오 : BOM에 관한
(나의 코드) http://koti.mbnet.fi/akini/java/unicodereader/UnicodeInputStream.java.txt
Usage pattern:
String enc = "ISO-8859-1"; // or NULL to use systemdefault
FileInputStream fis = new FileInputStream(file);
UnicodeInputStream uin = new UnicodeInputStream(fis, enc);
enc = uin.getEncoding(); // check and skip possible BOM bytes
InputStreamReader in;
if (enc == null) in = new InputStreamReader(uin);
else in = new InputStreamReader(uin, enc);
ByteArrayInputStream test = new ByteArrayInputStream(xml.trim().getBytes());
Document document = null;
try {
document = dbf.newDocumentBuilder().parse(test);
} catch (Exception e) {
System.out.println("Fehler 1" + e.getMessage()) ;
try {
test.close();
// ... that works: String xml_x = FkString.replace(xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
// Replace UTF-8 to UTF8 ... works
String xml_x = FkString.replace(xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<?xml version=\"1.0\" encoding=\"UTF8\"?>");
test = new ByteArrayInputStream(xml_x.trim().getBytes());
document = dbf.newDocumentBuilder().parse(test);
} catch (Exception e1) {
System.out.println("Fehler 2" + e1.getMessage()) ;
}
}