Update of patch #1582 (project freeciv):
Status: None => Ready For Test
Follow-up Comment #7:
New version attached thanks to the comments.
> UTF-8 doesn't use longer characters than 4-byte sequences.
> Freeciv shouldn't output anything outside of that (accepting
> it is ok I guess, but where would it come from?)
I set a variant for 6 bytes characters in a #ifdef block.
> Many of the functions are just there to make sure we do
> truncation in a "nice" way. IMO, truncation is the bad thing
> we are doing, it's not how we are doing it. We don't need
> this, if we stop truncating. However, a function to do
> truncation specifically when needed might be useful.
> We don't always want truncation when a string is not valid.
> Consider a string beginning with an Ö character in latin-1
> encoding. With this code, it would be truncated to a
> zero-length string. Often where illegal encodings are used,
> replacement chars are inserted instead. Would it be better to
> render it "?text continues" than just ""? (We could use U+FFFD
> "REPLACEMENT CHARACTER"). The latter use is much better when
> we deal with illegal encodings/wrongly encoded text. The
> former much better when "fixing up" truncation (so same thing
I added many fc_utf8_*_rep() functions to use the replacement character
instead of truncate the strings.
> two typos: uft8_char, fc_ut8_next_char
Didn't find. Where is it?
> Each function provided should do everything that it needs to.
> Specifically, fc_utf8_char_size is not a useful function in
> its current form (except for internal usage).
> Are we sure that using these variants everywhere is easier
> than converting all freeciv to wide characters?
I think it's really easier to use those functions instead of converting the
whole Freeciv codebase using wide characters because the usage of those
functions can be really local. We need them only for input checks (files and
Additional Item Attachment:
File name: trunk_utf8_utilities3.diff Size:32 KB
Reply to this item at:
Message posté via/par Gna!
Freeciv-dev mailing list