Skip to content

Improvements to utf8 handling.#36

Open
mikeashton-org wants to merge 3 commits intokruton:widecharfrom
mikeashton-org:widechar
Open

Improvements to utf8 handling.#36
mikeashton-org wants to merge 3 commits intokruton:widecharfrom
mikeashton-org:widechar

Conversation

@mikeashton-org
Copy link

Hello,

I had some problems getting your code to talk to a utf8 talker of mine, so I set about making some changes.

Firstly, my apologies for the mass-change pull request; I appreciate that's bad form. Even worse, this is in part because there's been some AI involved. I can understand if you want to tell me where to stick my vibe-coded drivel, but I can at least offer up that I've >30 years experience of doing it the old way :)

Anyway, these changes improve compatibility, but also fix some of (all of?) the issues you mentioned in the release notes, regarding byte-verses-character width processing on input and output, so I thought you might like to take a look. I'm keen to get utf8 support into the core tinyfugue offering, so if you'd like to work together to make that happen, I'm up for that. I think it's a bit silly to be viewing utf8 as new fangled fancy feature at this point in time.

…ues I was having with this version of tf not talking utf8 correctly to my utf8 enabled talker,

plus it addresses some of the byte-versus-character spacing issues in input processing mentioned in the change logs.

It does change the default character to utf8, which I appreciate is an invasive change.

I'm supporting that because, at this point in history, it feels more indicated than precipitous.
maths mixed with transpose being a tf function rather than a C
function.

The results of the limited testing I've done seems pretty nice -
transposing of superscripts all works like it should, and edits happen
in the right place, look right and have the expected outcome
* is preserved. */
if ((unsigned char)buf[i] < 0x80) {
if (istrip) buf[i] &= 0x7F;
if (buf[i] & 0x80) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this be true if line 149 is true? This already doesn't apply when WIDECHAR is defined, so this should be reverted.

Copy link
Author

@mikeashton-org mikeashton-org Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. Having this logic fire anyway appeared to solve a problem, but I'll go and look at this again - either it didn't really solve anything, and was just "solution adjacent", or the WIDECHAR conditional here isn't working as intended. I'll check it out and get back to you. Thanks for engaging.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on mobile now so I haven't reviewed the other code. but sometimes other places say #ifdef and maybe only this one says #if ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might have been before you enabled WIDECHAR ? Anyway, this will break non-UTF-8 versions, so it should be reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants