<i>utf-8 from&to and / binary encoding&decodeing conversation not the same</i> status still Open with 4 other changes
by
.
D 2019-02-22T10:05:44.712
J icomment Dear\samitego,\r\n\r\nyou\sneed\sbinary\sdata\s(bytes)\sfor\s"binary\sencode\sbase64".\r\nIf\syou\sfeed-in\snon-ninary\sdata,\sthe\sresult\sis\sundefined.\r\n\r\nLets\stake\sthe\sstring\s"ä".\r\nThis\sis\sone\scharacter\sof\sthe\sunicode\scodepoint\s\\u00e4.\sBy\schance,\sthe\svalue\sis\sbelow\s\\u00ff,\sso\sa\sconversion\sto\sbinary\sdoes\snot\sharm\sand\sthe\scharacter\spasses.\r\n\r\nLets\stake\sthe\scharacter\s"š".\r\nThis\sis\sone\scharacter\sof\sthe\sunicode\scodepoint\s\\u0161.\r\nIf\sthis\sis\streated\sas\sbinary,\sonly\sthe\slower\sbyte\sis\sretained.\r\nThis\sresults\sin\s\\u0061\swhich\scorresponds\sto\sthe\scharacter\s"a".\r\n\r\nYou\sobserve\sthis\stransformation\sin\syour\sexample.\r\n\r\nTo\stransform\sa\sstring\sinto\sbinary\sdata,\san\sencoding\sis\srequired.\r\nIf\syou\schoose\s"utf-8",\syou\sget:\r\n\r\n<verbatim>\r\n%\sset\su\s[encoding\sconvertto\sutf-8\sš]\r\nÅ¡\r\n%\sstring\slength\s$u\r\n2\r\n%\sscan\s$u\s%c%c\r\n197\s161\r\n</verbatim>\r\n\r\nThis\srepresentation\smay\sbe\sused\sby\sbinary\sencode.\r\n\r\nI\shope,\sit\sis\sgetting\sclearer\swhat\shappens.\r\nIt\sis\sdifficult\sbut\svery\spowerful.\r\n\r\nHope\sthis\shelps,\r\nHarald
J login oehhar
J mimetype text/x-fossil-wiki
J username oehhar
K b5cb29c639a5dab3b03e4d8827e7d4ab9b05ae61
U oehhar
Z 1aa1839aa5900b9517c37e261f00805e