Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Can't encrypt text with Turkish characters? #44

Closed
teytag opened this issue Jan 12, 2021 · 5 comments
Closed

Can't encrypt text with Turkish characters? #44

teytag opened this issue Jan 12, 2021 · 5 comments

Comments

@teytag
Copy link

teytag commented Jan 12, 2021

It does not encrypt a paragraph consisting of Turkish characters (like ş, ç, ü, ğ, ö). How can I solve this problem?

@avidcoder123
Copy link

Cryptico can't encrypt many Unicode characters. If you want to encrypt foreign characters, emojis, etc. You should first encodeURI(Turkish text), encrypt the encoded text, decrypt, and decodeURI(encoded plaintext). Example:

let turkishText = "Ölçek";
turkishText = encodeURI(turkishText); // Becomes "%C3%96l%C3%A7ek"
let cipher = cryptico.encrypt(turkishText, publicKeyHere).cipher;
let plaintext = cryptico.decrypt(cipher, privateKeyHere).plaintext;
decodeURI(plaintext); // Becomes Ölçek

This can be used to encrypt any Unicode text. @wwwtyro I think it would be helpful if Cryptico automatically encoded and decoded Unicode text.

@teytag
Copy link
Author

teytag commented Jan 12, 2021

The encodeURI() function encodes special characters, except: , / ? : @ & = + $ #
So, not work your solution.

let turkish = "Türkçe karakterleri şifreliyor artık!";
result decrypt decodeURl(turkish) -> T%C3%BCrk%C3%A7e%20karakterleri%20%C5%9Fifreliyor%20art%C4%B1k!

@avidcoder123
Copy link

I think you have misunderstood the response, you can encode any Unicode string with encodeURI. I have used Cryptico with encode/decodeURI in production, and it works perfectly fine. Cryptico does not have trouble encrypting / ? : @ & = + $ # so it does not matter if encodeURI does nothing to those characters. Something must have gone wrong in your implementation, as it works fine for me:
image

@teytag
Copy link
Author

teytag commented Jan 13, 2021 via email

@avidcoder123
Copy link

Request to close this issue

@teytag teytag closed this as completed Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants