Skip to main content



      Home
Home » Eclipse Projects » NatTable » Editing UTF-8 text
Editing UTF-8 text [message #1839373] Fri, 19 March 2021 10:57 Go to next message
Eclipse UserFriend
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 11:03] by Moderator

Re: Editing UTF-8 text [message #1839395 is a reply to message #1839373] Fri, 19 March 2021 15:28 Go to previous messageGo to next message
Eclipse UserFriend
Is your project configured for UTF8?
Re: Editing UTF-8 text [message #1839408 is a reply to message #1839395] Sat, 20 March 2021 02:23 Go to previous messageGo to next message
Eclipse UserFriend
Maybe also the conversion to the caconical value needs to respect UTF8 and not only calling toString()
Re: Editing UTF-8 text [message #1839453 is a reply to message #1839408] Mon, 22 March 2021 00:45 Go to previous messageGo to next message
Eclipse UserFriend
Yes, my project is configured for UTF-8.

I've also tried that, but it doesn't help.
Re: Editing UTF-8 text [message #1839455 is a reply to message #1839453] Mon, 22 March 2021 01:12 Go to previous messageGo to next message
Eclipse UserFriend
I just opened our EditorExample from within the IDE and entered special characters, like German umlauts. It simply works without any additional configuration or converters needed. I really can't tell why it is not working on your side.

Could you try our examples application and see if you face the same issue?
Re: Editing UTF-8 text [message #1839458 is a reply to message #1839455] Mon, 22 March 2021 02:19 Go to previous message
Eclipse UserFriend
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 02:19] by Moderator

Previous Topic:Summary row layer with mutliple rows
Next Topic:How to realize print preview?
Goto Forum:
  


Current Time: Sun May 18 04:29:38 EDT 2025

Powered by FUDForum. Page generated in 0.07084 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top