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

Bananas: name is truncated in in-game content downloader #6389

Closed
DorpsGek opened this issue Nov 10, 2015 · 8 comments
Closed

Bananas: name is truncated in in-game content downloader #6389

DorpsGek opened this issue Nov 10, 2015 · 8 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

dpk opened the ticket and wrote:

The name of my scenario is "dpk’s UK and Ireland Map (1900)". On the website this is displayed fine, but in game it's truncated to "dpk’s UK and Ireland Map (190".

Attachments

Reported version: 1.5.2
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/6389
@DorpsGek
Copy link
Member Author

Zuu wrote:

The reason for this is that ContentInfo::name is limited to 32 characters. This is also the number of characters OpenTTD receives from the content server.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6389#comment14082

@DorpsGek
Copy link
Member Author

dpk wrote:

Then the limit should be made larger, or the content service upload system should warn you about this, or (even better) forbid you from uploading things with names longer than that.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6389#comment14083

@DorpsGek
Copy link
Member Author

Eearslya wrote:

The problem is actually a little more complex; your scenario's name is only 31 characters long, but the apostrophe used is a special UTF-8 character that takes up 3 bytes instead of 1. The web frontend accepted it as one character, but the actual server and game code still use the UTF-8 apostrophe, causing it to be 33 characters, and thus truncated.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6389#comment14084

@DorpsGek
Copy link
Member Author

dpk wrote:

Then the server and game code should count Unicode codepoints for the limit, not bytes. (Incidentally, what happens if a UTF-8 codepoint is split in the middle by the truncator?)


This comment was imported from FlySpray: https://bugs.openttd.org/task/6389#comment14086

@DorpsGek
Copy link
Member Author

Eearslya wrote:

Unfortunately, that's just not how C++ works. Not without throwing the string through a UTF-8 -> ASCII parser, at least. The strings are all stored as null-terminated byte arrays. And if it did happen to truncate in the middle of a UTF-8 character, it would probably either render a garbage character, or nothing at all for that byte.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6389#comment14089

@DorpsGek
Copy link
Member Author

andythenorth wrote:

Confirmed OP's report in r27903


This comment was imported from FlySpray: https://bugs.openttd.org/task/6389#comment14662

@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 7, 2018
@TrueBrain
Copy link
Member

How C++ should be irrelevant for the user. It is weird that we limit on UTF8 on the website, and on ANSII ingame. One of the two has to give, to make a consistent experience.

That said, there is not a simple solution for this problem.

  • Changing the network protocol is far from an easy task; especially if we talk about making a single instance bigger.
  • Changing BaNaNaS is not something anyone would like to touch in its current state.

I think this should be tackled when-ever BaNaNaS is replaced; so I am tempted to pass on this. @andythenorth what do you think?

@andythenorth
Copy link
Contributor

Pass on this. In a better Bananas, it should be relatively easier I hope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

3 participants