From 3057475ddf7f73cbdc8530548850d8ef26ba1afe Mon Sep 17 00:00:00 2001 From: Piotr Wolny Date: Wed, 30 Jun 2010 17:43:11 +0200 Subject: [PATCH] Encode all non-ASCII characters. --- .../editor/PropertiesDocumentWrapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/gildur/simplepropertieseditor/editor/PropertiesDocumentWrapper.java b/src/org/gildur/simplepropertieseditor/editor/PropertiesDocumentWrapper.java index eed610d..62fc54d 100755 --- a/src/org/gildur/simplepropertieseditor/editor/PropertiesDocumentWrapper.java +++ b/src/org/gildur/simplepropertieseditor/editor/PropertiesDocumentWrapper.java @@ -108,11 +108,11 @@ public class PropertiesDocumentWrapper implements IDocument { public String get() { String content = document.get(); StringBuffer buffer = new StringBuffer(); - Charset latinCharset = Charset.forName("ISO-8859-1"); - ByteBuffer encodedUnknown = latinCharset.encode("?"); + Charset asciiCharset = Charset.forName("US-ASCII"); + ByteBuffer encodedUnknown = asciiCharset.encode("?"); for (int i = 0; i < content.length(); i++) { char c = content.charAt(i); - if (latinCharset.encode(String.valueOf(c)).equals(encodedUnknown)) { + if (asciiCharset.encode(String.valueOf(c)).equals(encodedUnknown)) { buffer.append(String.format("\\u%04x", (int) c)); } else { buffer.append(c);