Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Editing UTF-8 text
Editing UTF-8 text [message #1839373] Fri, 19 March 2021 14:57 Go to next message
Alexandra Tritean is currently offline Alexandra TriteanFriend
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 #1839395 is a reply to message #1839373] Fri, 19 March 2021 19:28 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Is your project configured for UTF8?
Re: Editing UTF-8 text [message #1839408 is a reply to message #1839395] Sat, 20 March 2021 06:23 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
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 04:45 Go to previous messageGo to next message
Alexandra Tritean is currently offline Alexandra TriteanFriend
Messages: 37
Registered: March 2020
Member
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 05:12 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 47
Registered: March 2020
Member
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 06:19 Go to previous message
Alexandra Tritean is currently offline Alexandra TriteanFriend
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

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


Current Time: Fri Mar 29 08:51:31 GMT 2024

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

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

Back to the top