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

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 added candidate: yes This Pull Request is a candidate for being merged size: small This Pull Request is small, and should be relative easy to process labels Dec 14, 2020
@TrueBrain TrueBrain force-pushed the multibyte branch 2 times, most recently from 61a5ca7 to 0244f07 Compare December 14, 2020 19:09
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 merged commit 68f9925 into OpenTTD:master Dec 14, 2020
@TrueBrain TrueBrain deleted the multibyte branch December 14, 2020 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate: yes This Pull Request is a candidate for being merged size: small This Pull Request is small, and should be relative easy to process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants