ZigEmbeddedGroup / serial

Serial port configuration library for Zig
MIT License
46 stars 18 forks source link

Use ANSI Windows API to fix improper UTF-16 use #13

Closed lachlanm-git closed 5 months ago

lachlanm-git commented 6 months ago

Fixes https://github.com/ZigEmbeddedGroup/serial/issues/12

Use the ANSI "A" style API over wide "W" style. Fix for:

Also, able to remove some @ptrCast() and @as() by cleaning up API function definitions to use [*] instead of *.

ikskuh commented 6 months ago

Have you verified this works?

lachlanm-git commented 5 months ago

Have you verified this works?

Yes, verified with zig 0.11.0 on Windows 10.

  1. "serial-list-info.exe" still prints OK. Previously I didn't notice this since I was just looking at the printed output. It looked OK as every 2nd byte of the slice was a '\0' character so wasn't observed.

  2. Here is a quick verification script I've run that works for me: https://gist.github.com/lachlanm-git/8a852c42b133ba24523751e9c708c242 It prints the number of characters which now match what I think we'd expect (previously it was twice as big). It then actually uses the .system_location to echo on an FTDI.