Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Chinese(and other non-English) symbols are not displayed #176

Open
ilyaryabchinski opened this issue Feb 24, 2023 · 4 comments
Open

Chinese(and other non-English) symbols are not displayed #176

ilyaryabchinski opened this issue Feb 24, 2023 · 4 comments

Comments

@ilyaryabchinski
Copy link

Hi! Huge thanks for your work on this great library!

Recently, I've been playing around with it in my Electron Project and found out that non-English symbols are not displayed correctly. I've seen similar issue and the corresponding PR that fixes it, but it seems like it's still the case.

Expected:
device manager

Actual behavior:
usb-detection

My Setup:
OS: Win10
Nodejs 16.10.0
usb-detection 4.14.1

How to reproduce:

  1. rename a device on your machine adding some non-English symbols as written in the article
  2. Try to detect devices using find method
@ilyaryabchinski
Copy link
Author

Hi! I am trying to debug the issue and dive a bit deeper. I haven't touched C++ since my uni classes and don't have a production experience with it. But what I've found out so far is that the symbols get corrupted even before we call the Utf8Encode function. So my guess is that it could be something wrong with the DllSetupDiGetDeviceRegistryProperty function which is imported from the dll. Could you please help me to investigate further and fix this?

image
image

@Julusian
Copy link
Contributor

As far as I'm concerned, this library is EOL #169.

Have you tried https://github.com/node-usb/node-usb? Maybe it will handle this better?

If you want to try and fix this, I expect its a problem of this using the SetupDiGetDeviceRegistryPropertyA (ansi) method from the DLL instead of the SetupDiGetDeviceRegistryPropertyW (unicode) version. Maybe it will work if you switch which ones it is importing and fix up any resulting type errors?

@ilyaryabchinski
Copy link
Author

Thanks @Julusian! I've just tried using SetupDiGetDeviceRegistryPropertyW and now it prints only first letters, I guess it has something to do with buf sizes 🤔
image

@ilyaryabchinski
Copy link
Author

ilyaryabchinski commented Feb 28, 2023

it doesn't work 😢 I tried to fix and change all the types to WCHAR and wstring but somehow broke the logic

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

No branches or pull requests

3 participants