-
Notifications
You must be signed in to change notification settings - Fork 261
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
gdImageXbmCtx is still locale-dependent #798
Comments
Thanks for reporting! I don't think we support EBCDIC, in which case it should be trivial to fix this. |
irony is that the buggy code came from PHP i guess the point of the logic is to try and create an identifier that is valid in X BitMap. that is based on C, but it's unclear which standard, so guessing the fact that newer C accepts Unicode names won't help. do we really need to output the name here in the first place ? what if we just hardcoded it to |
If somebody is really using this for including multiple XBMs in some C compilation unit, that won't work. On the other hand, I wonder whether anybody uses XBM at all nowadays. |
that's already not working:
our choices:
|
Oh, right, we never use that as filename, so I'd go with the latter (rename parameter, and don't mangle it anymore). |
@TysonAndre feel like sending a PR for that idea ? :) |
@TysonAndre good catch :) If API remains compatible (API and ABI), it can be done in 2.x, if not it has to wait 3.0 |
Also we could manually check for non ascii and replaced with _ if not ascii. The name of the generated code (the #define) has to be ascii anyway for those using it in X apps. Nobody I know uses XBM for anything else. And going to the troubles of allowing the filename to be different from the define is not worth it, and I am not sure all compilers support random filenames for source codes either :) |
we wouldn't really be breaking any API calls that aren't already broken |
@vapier I don't see how the api is broken but the unclear behavior for the name argument. What would you suggest? I am not sure to grasp the comments here about changing the name and the likes :) |
Line 225 in 0f9dd96
The parameter is called |
ah that correct. It was because the convention meant to have the same filename as the define. I am fine dropping the mangling. We could also simply rejecting non ASCII letters, underscore and digit first (what the C allows) , that can be considered as a bug fix as technically the file would be invalid. More work but fully compatible, mangle all non allowed characters using our own functions and update the documentation. I do favor the rejecting solution, less magic for the users. |
exactly I tend to:
thoughts? |
Describe the bug
The functions isupper and islower are locale-dependent. In the locale
"de_DE"
(ISO-8859-1, not UTF-8) and other locales, various bytes return true for islower. This would be incorrect for utf-8 where characters span multiple bytes.Expected behavior
Expected:
\xaa
replaced with_
after LC_CTYPE=de_DE on a system with that locale installedActual results
Observed(expected): That byte is not replaced.
Fix: Check for the specific characters instead of using islower/isupper/isdigit?
Environment (please complete the following information):
sudo locale-gen de_DE; sudo locale-gen de_DE.UTF-8
Additional information
https://www.cplusplus.com/reference/cctype/islower/
Noticed while working on php/php-src#7802
The text was updated successfully, but these errors were encountered: