Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTML5 escape sequence for ' #164

Merged
merged 3 commits into from Nov 28, 2022
Merged

Add HTML5 escape sequence for ' #164

merged 3 commits into from Nov 28, 2022

Conversation

sc68cal
Copy link
Contributor

@sc68cal sc68cal commented Nov 28, 2022

This is based off a bug report and discussion in the mastodon plugin for Bitlbee, where mastodon sends ' for single quotes in toots.

@sc68cal
Copy link
Contributor Author

sc68cal commented Nov 28, 2022

Looks like this needs some work, since it's turning ' into '#39;

@jelmer
Copy link
Member

jelmer commented Nov 28, 2022

It would probably make sense to support numbered entities across the board, rather than specifically #39.

@sc68cal
Copy link
Contributor Author

sc68cal commented Nov 28, 2022

@jelmer I'm fine with adding numbered entities, but I'd like some feedback on structure. Do I just add more entries to ent and keep the structure as is? Or are you thinking that the htmlentity struct needs changing, to hold the numeric representation?

typedef struct htmlentity {
	char code[7];
	char is[3];
	char numeric[7];
} htmlentity_t;

@sc68cal
Copy link
Contributor Author

sc68cal commented Nov 28, 2022

Ah, the numbers for the numeric representation map directly to their ASCII values, so maybe capture the whole string that represents the number, atoi it then back to char ?

@sc68cal
Copy link
Contributor Author

sc68cal commented Nov 28, 2022

I think for now i'll just add more to the list, rather than make large changes. Let me know if this is sufficient

@jelmer
Copy link
Member

jelmer commented Nov 28, 2022

Hmm. I think I've just changed my mind here. Supporting arbitrary numbers opens us up to a whole can of worms (do we allow you to insert � ?).

Maybe we can just support ' for now, and reevaluate if we end up with a long list of numbered entities here. (also, perhaps there's a library we're already depending on that has this functionality?)

@sc68cal
Copy link
Contributor Author

sc68cal commented Nov 28, 2022

That works for me.

@jelmer jelmer self-requested a review November 28, 2022 10:49
lib/misc.c Show resolved Hide resolved
@jelmer jelmer merged commit 7e90c03 into bitlbee:master Nov 28, 2022
@sc68cal sc68cal deleted the patch-1 branch December 4, 2022 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants