39aldo39/klfc

MS KLC 1.4 support?

mark-mcg opened this issue · 5 comments

Apologies if I've missed a setup option here, but I was looking to go from KLC -> JSON, and if i load any existing keyboard layout in KLC 1.4, save it, then attempt to parse it with klfc i get an error:

Active code page: 65001 klfc.exe: .\uk.klc: hGetContents: invalid argument (invalid byte sequence)

Having a quick look at the exported KLC examples, there appears to be a few more columns in the KLC file I created versus the example (see attached, generated by loading the existing UK keyboard layout).

uk.klc.txt

I think the problem is the encoding. KLFC tries to use UTF-8 for everything, but on Windows it is complicated, and I am not sure what the right thing to do is. Could you try explicitly saving the file as UTF-8? I think Notepad++ for example can do that.

BTW, if the problem is in the file itself, you would get a more explicit error message.

Spot on, converting to UTF8 in notepad++ resolved it, file parsed fine at that point. Thanks!

VS Code opens 1.4 klc files as UTF-16 LE, I like this project so may try to add some improvements once I've looked over the code, but any way to add an error catch for this where it retries using UTF-16 large endian?