Subj : Re: Need volonteers to test another patch To : Michiel van der Vlist From : Vitaliy Aksyonov Date : Sun Mar 03 2024 04:31 pm Hello Michiel. 03 Mar 24 22:31, you wrote to Nicholas Boel: NB>> So, at this point it's basically working and displaying properly, NB>> but then comes in the 'characters' vs 'bytes' thing that Golded NB>> isn't supporting, so it is wrapping what it thinks is double, NB>> triple, or even quadruple the amount of 'characters' that are NB>> there. MvdV> When it comes to mapping the number of characters to the number of MvdV> bytes, when you look at the UTF-8 encoding table, about two screens MvdV> down here: MvdV> https://en.wikipedia.org/wiki/UTF-8 MvdV> You can see that the length of the byte sequence can be determined MvdV> just by looking at the first byte. Look from bit 7 to the right. The MvdV> number of '1' bits equals the number of bytes in the character. All MvdV> the follow up bytes start with '10'. So to get the number of MvdV> characters ignore the bytes starting with '10' when counting the MvdV> bytes. MvdV> Breaking a line should only occur /before/ a byte starting with '0' or MvdV> '11'. MvdV> Knowing all that it should be doable to let Golded display properly. MvdV> Perhaps the best strategy is to have Golded alway use UTF-8 MvdV> internally. Almost everyone else does these days... That would be perfect. It only takes huge amount of effort. Especially with keeping code backward compatible with systems, which may not have Unicode support. I keep thinking about it and looking for possible ways to implement. For now I'd be happy to make iconv work properly. In this case GoldEd user may get rid of most (if not all) of translation tables. The problem is that source code has huge amounts of duplicated code and sometimes functions and variables names say nothing about what do they do. I spend huge amount of time just to understand what's going on. For example function, which splits message to lines is almost 1000 lines long! It has variables, used in multiple places, it not only splits the message, but guess charset, do recoding and other fun stuff. Vitaliy --- GoldED+/LNX 1.1.5-b20240223 * Origin: Aurora, Colorado (1:104/117) .