7 Commits

Author SHA1 Message Date
Piotr Wolny
73bad66829 New version. 2014-05-20 10:58:35 +02:00
Piotr Wolny
2137715576 Do not escape question mark ('?'). 2014-05-20 10:57:56 +02:00
Piotr Wolny
a2bc4e5749 New version. 2014-04-24 11:05:20 +02:00
Piotr Wolny
0ee301e5a7 Encode using capital letters. 2014-04-24 11:05:20 +02:00
Piotr Wolny
d2348f8761 Ignore binaries. 2014-04-24 11:05:20 +02:00
Piotr Wolny
93fe36d159 New version. 2010-06-30 18:12:14 +02:00
Piotr Wolny
3057475ddf Encode all non-ASCII characters. 2010-06-30 17:43:11 +02:00
3 changed files with 6 additions and 5 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/bin

View File

@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SimplePropertiesEditor
Bundle-SymbolicName: SimplePropertiesEditor; singleton:=true
Bundle-Version: 1.0.0
Bundle-Version: 1.0.3
Bundle-Activator: org.gildur.simplepropertieseditor.Activator
Bundle-Vendor: Piotr Wolny
Require-Bundle: org.eclipse.core.runtime,

View File

@@ -108,12 +108,12 @@ 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)) {
buffer.append(String.format("\\u%04x", (int) c));
if (c != '?' && asciiCharset.encode(String.valueOf(c)).equals(encodedUnknown)) {
buffer.append(String.format("\\u%04X", (int) c));
} else {
buffer.append(c);
}