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

Codechange: use \u to indicate unicode chars in most parts of the code #8379

Merged
merged 1 commit into from Dec 14, 2020

Conversation

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Dec 14, 2020

With \x, we sometimes had to do the "" trick, as the length is not
predefined. With C++11 bringing \u to the specs, which has a preset
length, we no longer need the "" trick.

We set the strings to u8, to ensure all compilers use UTF-8 encoding
for the \u characters.

This was triggered by newer CLangs, which start to warn if you
use "" in the middle of a string, wondering if that was your
intention. It is a good question. And this is our answer :)


I did not do this fully by hand. I used:

https://gist.github.com/TrueBrain/5dc9da276f86259df358a2e928fc2fdc

And added u8 in front of it by hand, as well as string-replace "" away.

@TrueBrain TrueBrain force-pushed the TrueBrain:multibyte branch 2 times, most recently from 61a5ca7 to 0244f07 Dec 14, 2020
With \x, we sometimes had to do the "" trick, as the length is not
predefined. With C++11 bringing \u to the specs, which has a preset
length, we no longer need the "" trick.

We set the strings to u8, to ensure all compilers use UTF-8 encoding
for the \u characters.

This was triggered by newer CLangs, which start to warn if you
use "" in the middle of a string, wondering if that was your
intention. It is a good question. And this is our answer :)
@TrueBrain TrueBrain force-pushed the TrueBrain:multibyte branch from 0244f07 to 1f56659 Dec 14, 2020
@TrueBrain TrueBrain merged commit 68f9925 into OpenTTD:master Dec 14, 2020
6 checks passed
6 checks passed
Linux (clang, clang++)
Details
Commit checker
Details
Linux (gcc, g++)
Details
Mac OS (x64, x86_64) Mac OS (x64, x86_64)
Details
Windows (x86) Windows (x86)
Details
Windows (x64) Windows (x64)
Details
@TrueBrain TrueBrain deleted the TrueBrain:multibyte branch Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants