mirror of
https://github.com/gildur/SimplePropertiesEditor.git
synced 2026-04-02 16:19:47 +09:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d7aa9ee7c | ||
|
|
a19a30490d | ||
|
|
73bad66829 | ||
|
|
2137715576 | ||
|
|
a2bc4e5749 | ||
|
|
0ee301e5a7 | ||
|
|
d2348f8761 | ||
|
|
93fe36d159 | ||
|
|
3057475ddf |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/bin
|
||||
@@ -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.4
|
||||
Bundle-Activator: org.gildur.simplepropertieseditor.Activator
|
||||
Bundle-Vendor: Piotr Wolny
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
|
||||
@@ -46,13 +46,10 @@ public class PropertiesDocumentProvider extends FileDocumentProvider {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
for (int i = 0; i < content.length(); i++) {
|
||||
char c = content.charAt(i);
|
||||
if (c == '\\') {
|
||||
c = content.charAt(i + 1);
|
||||
if (c == 'u') {
|
||||
int code = Integer.parseInt(content.substring(i + 2, i + 6), 16);
|
||||
buffer.append((char) code);
|
||||
i += 5;
|
||||
}
|
||||
if (c == '\\' && i < content.length() - 1 && content.charAt(i + 1) == 'u') {
|
||||
int code = Integer.parseInt(content.substring(i + 2, i + 6), 16);
|
||||
buffer.append((char) code);
|
||||
i += 5;
|
||||
} else {
|
||||
buffer.append(c);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user