1
DBからデータを読み取り、それらのデータをDataObjectに割り当てようとしています。 DBの列の1つに無効な文字があります(画像http://i.stack.imgur.com/6bpx4.pngの強調表示されたテキスト領域を参照してください)。これはXML UTF-8で解析できません。事前XMLで無効な文字を解析する
で おかげで現在では無効な文字が最後に私の私の問題を解決するには、..
たぶんあなたは非印字および制御の両方を削除したい
try {
out = new StringBuffer(); // Used to hold the output.
char current; // Used to reference the current character.
if (in == null || ("".equals(in))) return ""; // vacancy test.
for (int i = 0; i < in.length(); i++) {
current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught here; it should not happen.
if ((current == 0x9) || (current == 0xA) || (current == 0xD) || ((current >= 0x20) && (current <= 0xD7FF)) ||
((current >= 0xE000) && (current <= 0xFFFD)) || ((current >= 0x10000) && (current <= 0x10FFFF)))
{
out.append(current);
}
}
return out.toString();
解決策と考えられるものについて詳しく説明してください。 –
あなたの言っていることが無効であることがわかりません。フィールドにはUTF-8でエンコードされたテキストが含まれていますが、それに含まれるバイトシーケンスには無効なUTF-8が含まれていますか?あるいは、一連の文字をXML文書に入れたいのですが、XMLには禁止されている文字が含まれていますか? –