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

Utf8 labels #4

Open
PhoenixFnX opened this issue Aug 5, 2014 · 3 comments
Open

Utf8 labels #4

PhoenixFnX opened this issue Aug 5, 2014 · 3 comments

Comments

@PhoenixFnX
Copy link

Hi,

in the function "testFitStringInTextBox" in driver.php
you tokenize the string using $tokens = preg_split( '/\s+/', $string );
when $string is in UTF 8 and using a 2 bytes character, the $tokens get corrupted and the labels can be turned to an empty string when the svg.php encodes() it using htmlspecialchars (returns empty string if char is wrong)

So the tokenization should take care of the encoding option !

Thank you for these components !
Nicolas.

@scfc
Copy link

scfc commented Aug 5, 2014

Do you have an example that shows the error?

Under normal circumstances, this can't happen, because either preg_split() handles UTF-8 and everything's fine, or if it doesn't, \s matches only on characters < 128 which appear in UTF-8 as themselves. Only bytes with the first bit 1 (= 128…255) can occur in different characters.

@PhoenixFnX
Copy link
Author

The example is "test testà" (UTF8 encoded, à is c3a0 http://www.fileformat.info/info/unicode/char/00e0/index.htm)
The preg_split returns
array[0] = test
array[1] = test?

where ? is a bad character which ord is 195. When passed into htmlspecialchars, it crashes

@madscientist159
Copy link
Contributor

madscientist159 commented Jun 29, 2016

We just ran into this on a production system. It does seem unique to French, specifically using the à character in a label on a Windows machine will cause the label not to display.

EDIT: The fix is trivial, patch incoming shortly.

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

No branches or pull requests

3 participants