Page 1 of 1

[fixed]CGUITable::deserialize() doesn't use correct string getter

Posted: Sun Apr 24, 2022 8:53 am
by chronologicaldot
In my problems here [link]viewtopic.php?f=6&p=306532#p306532[/link], I inadvertently discovered that part of the reason Asian text doesn't show up is because getAttributeAsString() is being used where stringw is sought.
Code from line 1255 of CGUITable.cpp (of rev 6221):

Code: Select all

	cell.Text = core::stringw(in->getAttributeAsString(label.c_str()).c_str());
Should be:

Code: Select all

	cell.Text = in->getAttributeAsStringW(label.c_str());
This allows getAttributeAsStringW() to secretly perform any conversion from char to wchar_t if the string to be returned isn't already wchar_t.

I'm guessing the original code was probably written before there was a getAttributeAsStringW().

I checked the other GUI elements, and all but one other were fine. CGUIFileOpenDialog uses getAttributeAsString() regardless of platform. Should be stringw on Windows I would think, but then again it should be io::path for fschar_t, lol. Easiest thing would be to use the #ifdef _IRR_WCHAR_FILESYSTEM
I'm tired and going to bed.

Re: CGUITable::deserialize() doesn't use correct string getter

Posted: Sun Apr 24, 2022 2:52 pm
by CuteAlien
Thanks, nice find! Will fix it next days.

Re: CGUITable::deserialize() doesn't use correct string getter

Posted: Sun Apr 24, 2022 9:27 pm
by chronologicaldot
I just found out line 1220 does it too.

Code: Select all

		column.Name = core::stringw(in->getAttributeAsString(label.c_str()).c_str());

Re: CGUITable::deserialize() doesn't use correct string getter

Posted: Mon Apr 25, 2022 9:49 am
by CuteAlien
OK, changed both in svn trunk [r6358].
Did not touch CGUIFileOpenDialog for now... that one is probably not a one minute thing to avoid messing it up.

Re: CGUITable::deserialize() doesn't use correct string getter

Posted: Wed Apr 27, 2022 12:12 am
by chronologicaldot
Sadly, though it was part of the problem, it still doesn't fix the problem with Asian text not showing up, at least for me, but it seems the problem is still unique to CGUITable, maybe in breakText()? -\_(ツ)_/- I guess I just have bad luck in this area.

Re: CGUITable::deserialize() doesn't use correct string getter

Posted: Wed Apr 27, 2022 1:06 am
by chronologicaldot
Correction, my problem seems to be that I can't get my program to compile while recognizing new changes made to Irrlicht. UGH!

Re: CGUITable::deserialize() doesn't use correct string getter

Posted: Wed Apr 27, 2022 1:21 am
by chronologicaldot
Update: Ok, it all works now. I had some unrelated compilation issue getting in my way.