[fpc-devel] Unicode resource strings

Marco van de Voort marcov at stack.nl
Wed Aug 22 09:02:08 CEST 2012


In our previous episode, Hans-Peter Diettrich said:
> > utf8/16 -> ansi are a bit more involved. (since mapping many chars to few,
> > naieve implementation requiring large lookupsets)
> 
> A single 256 element array can be used for both directions. In Ansi to 
> Unicode the char value is used to index the array of Unicode values, 
> otherwise the given Unicode value is searched in the array.

That is an option also of course, but O(n). Probably the better solution is
what was mentioned before, have a set of ranges and smaller lookuptables for
these ranges.

This lowers the set size at the expense of a few (constant time)
comparisons.



More information about the fpc-devel mailing list