TextEditor and NULLs in String

Is there a way to display a string that has NULLs (more then one at the end) in it, i would like to display a binary file (small one, less then 1mb). But it loads only up till the first NULL, and i imagine this is how it should work.

Also i tried replacing the NULLs in the String with the replaceCharacter() method but it asserts on ‘\0’.

Do i have to replace the NULLs on the MemoryBlock level, load it to the TextEditor with NULLs replaced, and when saving back re-replace the characters?

Yes, if it’s binary then you’d have to just deal with it as a memory block.

i have to follow up.

I got the display, replaced NULLs with dots.

but how do i get the information back if it changed in the editor. obviously there is no character in the unicode set that can’t be found in a binary file. So there is no character i can replace NULLs with that i can say will be distinct.

I thought of tracking changes in the text editor through the TextEditorListener callbacks, but when changes occur i’d have to find what happened, and there is no easy way to do this.

Any hints on how to do this ?

…yeah, it’s really not at all what strings are designed to do! A quick hack would be to treat the file as ascii rather than unicode, I guess, then you’d be able to use a character > 255 for the nulls…