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

{unicode: true} does not work for me #19

Open
timsazon opened this issue Jun 1, 2019 · 2 comments
Open

{unicode: true} does not work for me #19

timsazon opened this issue Jun 1, 2019 · 2 comments

Comments

@timsazon
Copy link

timsazon commented Jun 1, 2019

Hi! I've tried the beta version of your library with Unicode option support but it doesn't work. Still, return ??? instead Unicode symbols.
Tested on W10 Version 10.0.17763 Build 17763
Example of code (value in registry C:\Program Files\TeamSpeak 3 Client Реестр):

async function getTeamSpeakDirectory() {
  let path = await Registry.get('HKLM\\Software\\TeamSpeak 3 Client', '', {unicode: true});
  if (!path) path = await Registry.get('HKCU\\Software\\TeamSpeak 3 Client', '');
  console.log(path); // C:\Program Files\TeamSpeak 3 Client ??????
  return path;
}

It looks like 'cmd.exe /c chcp.com 67001' does not change encoding for next call,
await Registry.getCodePage() return 437 after await Registry.setCodePage(67001).

@OddMorning
Copy link
Collaborator

That's really strange. I just checked your code on Win7, Win10 1803, and Win10 1903 (the May 2019 one) and it worked as intended.

Can you try to use await Registry.enableUnicode() before await Registry.get(<…>) instead of {unicode: true}? Or try to manually enter .setCodePage(65001) / cmd.exe /c chcp.com 65001 instead of 67001.

@timsazon
Copy link
Author

timsazon commented Jun 1, 2019

Yes, I've already tried (67001 was just a typo in the issue), nothing changes. Btw, I stopped at this solution with regedit library and it's fine:

export async function getRegistryValue(path, key) {
  return await new Promise(resolve => {
    regedit.list(path, function (err, result) {
      if (err) return resolve(undefined);
      resolve(result[path].values[key] ? result[path].values[key].value : undefined);
    });
  })
}

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

2 participants