ClassiCube / MCGalaxy

A Minecraft Classic / ClassiCube server software
GNU General Public License v3.0
160 stars 75 forks source link

Zero width joiner is rendered incorrectly #559

Open Sanqui opened 3 years ago

Sanqui commented 3 years ago

Re-reported from https://github.com/UnknownShadow200/ClassiCube/issues/729.

Our Discord-IRC bridge uses ZWJ characters between letters to avoid pinging people on IRC. These should be completely invisible, but MCGalaxy translates them into question marks for clients:

image

I believe it would be ideal if the following three characters simply got stripped from messages:

Do you think this is a good first issue for a PR? Can you suggest a file to look at?

UnknownShadow200 commented 3 years ago

Replacing characters from IRC should go in the misleadingly named ConvertIRCToMC method in Chat\Colors.cs

What you'd want to add here is probably just

// remove zero width characters 
sb.Replace("\u200c", "");
sb.Replace("\u200d", "");
sb.Replace("\ufeff", "");