Encoding like in .properties files with \u notation

Is there an encoding that encodes files with the unicode \u notation ?GreetingsMichael
[107 byte] By [wihsboecka] at [2007-10-2 8:27:24]
# 1
There is a utility that can convert to that notation FROM specific encodings - native2ascii which comes with the JDK.
one_danea at 2007-7-16 22:27:46 > top of Java-index,Desktop,I18N...
# 2
Thanks for reply, i know native2ascii, but i would like to encode the Stream direct from the Java code, it's for a simple i18n manager.Michael
wihsboecka at 2007-7-16 22:27:46 > top of Java-index,Desktop,I18N...
# 3

Then write a subclass of FilterWriter that implements its methods to convert each char to that notation and pass the converted strings on to its wrapped Writer. Something like this:public class SlashUWriter extends FilterWriter {

private Writer writer;

public SlashUWriter(Writer w) {

writer = w;

}

public void write(int c) {

writer.write("\\u");

String hex = Integer.toHexString(c);

while (hex.length() < 4) {

hex = "0" + hex;

}

writer.write(hex);

}

// override the other two "write" methods similarly

// override "flush" and "close" to flush and close the writer

}

DrClapa at 2007-7-16 22:27:46 > top of Java-index,Desktop,I18N...
# 4
Thanks!Now i've implemented it analog to the source of java.util.Properties, the FileWriter method is also a nice idea :)GreetingsMichael
wihsboecka at 2007-7-16 22:27:46 > top of Java-index,Desktop,I18N...