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

luautf8 needs utf8.format (to replace string.format) #52

Open
cloudranger opened this issue Aug 13, 2024 · 0 comments
Open

luautf8 needs utf8.format (to replace string.format) #52

cloudranger opened this issue Aug 13, 2024 · 0 comments

Comments

@cloudranger
Copy link

Your README says "Some routines in string module needn't support Unicode: string.format"
However, this code is proof that string.format does need unicode support:

print(string.format("%-35s", "abcdefghijklmnopqrstuvwxyz"))
print(string.format("%-35s", "àb¢défghijklmnöpqrstüvwxyz"))

string.format does not count utf8 characters, it counts the number of bytes, so when you used a fixed size in the formatting string and accented characters are used, string.format gets it wrong.

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

No branches or pull requests

2 participants