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

Data corruption when sending UTF-8 encoded LDIF values. #1

Open
felixvf opened this issue Jun 18, 2019 · 0 comments
Open

Data corruption when sending UTF-8 encoded LDIF values. #1

felixvf opened this issue Jun 18, 2019 · 0 comments

Comments

@felixvf
Copy link

felixvf commented Jun 18, 2019

The current version of ldapply ignores the charset when reading the .ldif file but then tries to send the data to the LDAP server, it encodes the data to the encoding of the current locale as if the data was encoded in ISO-8859-1.

This means:

  1. If there are just ASCII codepoints and no non-ASCII UTF-8 codepoints, everything is fine. Hence, "foo" stays "foo".
  2. If the current locale is "C" (e.g. export LANG=), UTF-8 non ASCII codepoints get silently replaced by empty strings. Hence, "Iñtërnâtiônàlizætiøn" is mutilated into "Itrntinliztin".
  3. If the current locale is "en_US.UTF-8" (e.g. export LANG=en_US.UTF-8), UTF-8 non ASCII codepoints get silently re-encoded into UTF-8. Hence, "Iñtërnâtiônàlizætiøn" is mutilated into "Iñtërnâtiônàlizætiøn".
  4. If the current locale is "en_US.ISO-8859-1" (e.g. export LANG=en_US.ISO-8859-1), UTF-8 non ASCII codepoints get transparently re-encoded (as if they were not re-encoded at all). Hence, "Iñtërnâtiônàlizætiøn" stays "Iñtërnâtiônàlizætiøn".

Thus, oddly enough, only when the locale is a non UTF-8 locale, UTF-8 handling gets done correctly (albeit accidentally). It is expected that the action of ldapply be independent of the locale, of it is were locale dependent, then the locale would influence how the local .ldif file would be interpreted, not how to encode for the remote server.

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

1 participant