|Re: Save value to file: support specific encoding [message #9428 is a reply to message #9381]
||Tue, 10 March 2009 20:23
| Taras Tielkes
Registered: July 2009
I'm saving the value of one single java.lang.String instance to a file.
Right now, the generated file uses a UTF-16 encoding, for which support
in 'common' programs/tools is kind of spotty.
I'd like to have at ASCII or UTF-8 as options:
1) UTF-8 is pretty well-supported in most editors/tools
2) ASCII is universally supported of course
In the case of ASCII, it's possible that the String instance contains
non-ASCII characters. If this is the case, I'd like MAT to notify me,
So, in summary, my use case applies to strings only, and the main
motivator is the relatively spotty support for UTF-16.
P.S. Any chance for a new release sometime soon? :-)
Andreas Buchen wrote:
> Hi Taras,
> currently the logic is this (I think you mean the Save to File context
> * if only one object is selected, write the data in such a way that one
> can read it via the DataInputStream (e.g. is it written as is via
> * if more than one object is selected, the string representation of the
> objects is written to the text file. The output file uses the system
> encoding: System.getProperty("file.encoding") Do you want a choice of
> encodings here? It would only change what you need to tell your text
> editor how to load the file.
> Could it be that you have a byte array that contains text and we do not
> convert that properly? For byte arrays we do this:
> if (val >= 32 && val < 127)
> result.append("\\u").append(String.format("%04x", 0xFFFF & val));
Powered by FUDForum
. Page generated in 0.05941 seconds