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

MS KLC 1.4 support? #29

Open
mark-mcg opened this issue Aug 6, 2020 · 5 comments
Open

MS KLC 1.4 support? #29

mark-mcg opened this issue Aug 6, 2020 · 5 comments

Comments

@mark-mcg
Copy link

mark-mcg commented Aug 6, 2020

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

@39aldo39
Copy link
Owner

39aldo39 commented Aug 6, 2020

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.

@mark-mcg
Copy link
Author

mark-mcg commented Aug 6, 2020

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

@jpc-ae
Copy link

jpc-ae commented Apr 18, 2022

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?

@jarnowic
Copy link

a pipe running iconv -f utf16 -t utf8 <filename>.klc | klfc --from-klc - <etc> did the trick for me...

@DreymaR
Copy link

DreymaR commented Jun 19, 2024

Yes, MSKLC uses UTF-16 (LE) encoding natively. I don't think it'll work with other encodings? Therefore, KLFC should use this encoding too.

As pointed out in another recent issue, KLFC also needs to use CRLF line endings for KLC files. It should do so regardless of the OS it is run under.

See the EPKL MSKLC folder:
https://github.com/DreymaR/BigBagKbdTrixPKL/tree/master/Other/MSKLC#technicalities

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

5 participants