Page 1 of 1

XML -> Scintilla

Posted: Mon Feb 16, 2026 4:09 am
by syntonica
I'm accessing an XML database exported from a Java Properties file. The nodes are coded as key/value pairs thusly:

Code: Select all

<entry key="aKey">aValue</entry>
I have extracted the pairs into a map, but it seems the values are stored as UTF-16 rather than the UTF-8 from the file. When I try to stuff a value into a Scintilla text box, it appears it wants the original UTF8.

Normally, this wouldn't be an issue. I can recode back to UTF8. However, the user can navigate through screens several times a second, depending on what they are doing, which makes for dozens of unnecessary allocations/deallocations and CPU cycles.

My questions are:
1. Are my worries about reencoding texts, which can go up to 64K and above in size, a tempest in a teapot?
2. Can I prevent the reencoding when extracting to the map?
3. If not, can I access the XML nodes directly by the attribute (key)? The nodes seem to be addressable only by number.
4. If I use a different XML schema, rather than abusing the attribute function like Java does here, would that be a better solution for querying the XML directly? E.g.

Code: Select all

<aKey>aValue</aKey>
[or more properly]
<key>aKey</key><value>aValue</value>
This is all to avoid writing my own text gadget to have full access to keystrokes and mouse interaction, i.e., a custom context menu that integrates with spellcheck, dictionary, and other program features. This is the last problem to solve before I really dive in to coding an OOP program procedurally. :cry:

Re: XML -> Scintilla

Posted: Mon Feb 16, 2026 9:37 am
by Fred
Better write your stuff the easy way and if you see any issue, find another solution (ie: optimize last). Re-encoding is ligthning fast and shouldn't be an issue.

Re: XML -> Scintilla

Posted: Mon Feb 16, 2026 7:26 pm
by syntonica
There's a difference between premature optimization and just plain bad ideas. I'm trying to rule out the latter here. I can't do anything much about performance until I see the finished result and how it compares to the Java version.