-
Notifications
You must be signed in to change notification settings - Fork 43
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
Fix calculating button absolute path length #184
Conversation
Fix calculating button absolute path length with non-Latin symbols according issue EdJoPaTo#183
I added a test case which interestingly also works when using the old logic with |
this could not work before because in utf-8 encoding Russian characters start from 1040, which is 2 bytes |
Done |
As I can see, there is another one problem with Buffer with typescript? but I never used typescript and don't know how to fix it, please take a look :) |
I already fixed them in my first commit (570930e) I think I understand the thought behind your change in 6aa40e6 but the Keyboard class takes a relative path (without the Looks like JavaScript String.length uses UTF-16 which is why it also correctly identified the cyrillic letters to use 2 characters. So for everything within the UTF-8 range String.length should work fine which is the current behaviour. Not sure what the issue in #183 is when the |
ok, could you just run next code in node? I'm getting false for both cases So String.length returns the number of characters, not the length of the bytes, but the TG API calculates the length of the bytes, that's the problem |
The testcase was done misleading which resulted in to many characters. Therefore it did not test what it was supposed to test.
Sorry for the long delay… I found out my confusion why String.length seemed to work. The testcase I wrote used your 48 character string twice which ended up being >64 anyway. Both characters and bytes were too long so String.length also seemed to work for that case. I fixed the testcase in f240b9f. Using String.length with the fixed testcase makes a difference which resolves my confusion about it. Thank you for reporting that problem and providing the fix! Sorry again for my long delay in handling this. |
Fix calculating button absolute path length with non-Latin symbols according issue #183