I use MIME::Base64 to encode some strings to safely pass over a URL But there are time where the code breaks due to wide characters
How can I safely encode wide characters, I need not use MIME::Base64 , any lightweight encoding will work for me
use MIME::Base64;
print MIME::Base64::encode_base64("\x{2019}s text");
print "\nBye\n";
As you can see in the documentation, encode_base64
accepts bytes as the argument. To get bytes from a string, encode it:
use Encode;
print MIME::Base64::encode_base64(encode('utf-8', "\x{2019}s text"));
Don't forget to decode
back on the receiving side!