node-ldapjs icon indicating copy to clipboard operation
node-ldapjs copied to clipboard

utf-8 encoding, foreign language (Spanish)

Open Rebecasarai opened this issue 4 years ago • 4 comments

Hi!

The receiver terminal (That makes the ldap search) can't read or show utf-8 characters, in this case, the "Ñ".

When I print in console from the server.search() function I can see the string responses clearly, I can read correctly the data and the "Ñ". But not from the other terminal that receives the response.

How can I fix this?

I tried the library utf-8 enconding and decoding but doesn't work. Also tried setting the charset in the response, but it didn't work either.

Rebecasarai avatar Apr 15 '20 21:04 Rebecasarai

Now also doing
Buffer.from(users[i].LASTNAME, 'base64').toString('utf-8')

And what it does is that it doesn't show the special character Ñ. So for example, the last name "Nuñez" will show as "Nuez".

How can it be shown as "Nuñez"? Is it because of the LDAP version itself?

Rebecasarai avatar Apr 15 '20 21:04 Rebecasarai

I do not understand the issue. Is ldapjs returning an error?

jsumners avatar Apr 15 '20 23:04 jsumners

Hi @jsumners ldapjs is returning incorrect strings when there are special characters in it.

Only when there is a special character, it transforms it to Base64 automatically.

image Here in the server, it reads the string correctly, but it returns this other weird string

Rebecasarai avatar Apr 16 '20 10:04 Rebecasarai

Are you able to provide a reproduction test case in our integration tests (on the next branch)?

jsumners avatar Apr 16 '20 13:04 jsumners

👋

On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.

Please see issue #839 for more information, including how to proceed if you feel this closure is in error.

jsumners avatar Feb 22 '23 19:02 jsumners