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

Unrecognizable characters when listing serial ports

Open cyberxnomad opened this issue 3 years ago • 1 comments

SerialPort Version

10.4.0

Node Version

v18.2.0

Electron Version

18.2.4

Platform

Microsoft Windows NT 10.0.19044.0

Architecture

x64

Hardware or chipset of serialport

No response

What steps will reproduce the bug?

in Command Line: serialport-list also exists when using SerialPort.list() in programming

What happens?

Unrecognizable characters when listing serial ports:

{"path":"COM1","manufacturer":"(��׼�˿�����)","pnpId":"ACPI\\PNP0501\\0","friendlyName":"ͨ�Ŷ˿� (COM1)"}
{"path":"COM8","manufacturer":"Vyacheslav Frolov","pnpId":"COM0COM\\PORT\\CNCA0","locationId":"CNCA0","friendlyName":"com0com - serial port emulator (COM8)"}
{"path":"COM9","manufacturer":"Vyacheslav Frolov","pnpId":"COM0COM\\PORT\\CNCB0","locationId":"CNCB0","friendlyName":"com0com - serial port emulator (COM9)"}

What should have happened?

what to display in python

0:<serial.tools.list_ports_common.ListPortInfo object at 0x0000016C996C2D40>
special variables
function variables
description:'通信端口 (COM1)'
device:'COM1'
hwid:'ACPI\\PNP0501\\0'
interface:None
location:None
manufacturer:'(标准端口类型)'
name:'COM1'
pid:None
product:None
serial_number:None
vid:None

Additional information

No response

cyberxnomad avatar May 23 '22 04:05 cyberxnomad

I've also hit this problem. We've gotten a couple issues related to this on this extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-serial-monitor. (https://github.com/microsoft/vscode-serial-monitor/issues/29, https://github.com/microsoft/vscode-serial-monitor/issues/13).

Looping in the maintainers of https://github.com/serialport/bindings-cpp, @reconbot, @HipsterBrown.

I attempted to look into where this might be coming from, and while I'm very out of practice with my C++, I wonder if the manufacturer name and the friendlyName need to be converted to utf8 or retrieved in some other way rather than simply the current strdup that is used.

Let me know if there's any way that I can help!

UPDATE: It seems there's a PR out that has an attempted fix, has the fix been tested and if so, is there any reason it can't be merged?

gcampbell-msft avatar Jul 22 '22 18:07 gcampbell-msft