Editing UTF-8 text [message #1839373] |
Fri, 19 March 2021 14:57 |
Alexandra Tritean Messages: 37 Registered: March 2020 |
Member |
|
|
Hello,
I'm trying to display and edit an UTF-8 text in a NatTable and I'm not sure what I'm missing.
I have managed to display it correctly by implementing a DisplayConverter.
class UTF8DisplayConverter extends DisplayConverter {
@Override
public Object canonicalToDisplayValue(Object canonicalValue) {
byte[] bytes = canonicalValue.toString().getBytes();
return new String(bytes, StandardCharsets.UTF_8);
}
@Override
public Object displayToCanonicalValue(Object displayValue) {
return displayValue.toString();
}
}
The problem is that as soon I'm editing it the characters are 'going back' to the 'weird' ones (the ones that I had before implementing the Converter).
Is there anything that I have to implement in addition to the Converter or is the Converter not correct implemented?
Thank you!
Kind Regards,
Alexandra
[Updated on: Fri, 19 March 2021 15:03] Report message to a moderator
|
|
|
|
|
|
|
Re: Editing UTF-8 text [message #1839458 is a reply to message #1839455] |
Mon, 22 March 2021 06:19 |
Alexandra Tritean Messages: 37 Registered: March 2020 |
Member |
|
|
Indeed, that example works for me too.
Maybe the file that I'm using as 'support' for the NatTable is not behaving correctly.
At least now I know that from the NatTable point of view everything is correct and I can investigate in other directions.
Thank you very much for your help!
[Updated on: Mon, 22 March 2021 06:19] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03717 seconds