Path: csiph.com!aioe.org!news.mb-net.net!open-news-network.org!.POSTED.59.236.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Base64 encode using using windows-1250 encoding Date: Sat, 09 Jun 2018 10:12:53 +0200 Organization: PointedEars Software (PES) Lines: 72 Message-ID: <3623877.9AgGOrEZyW@PointedEars.de> References: <3469849.XUi3uDslzQ@PointedEars.de> <16824345.heBUIXtyyW@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit Injection-Info: gwaiyur.mb-net.net; posting-host="59.236.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch:178.197.236.59"; logging-data="16781"; mail-complaints-to="abuse@open-news-network.org" User-Agent: KNode/4.14.2 Cancel-Lock: sha1:GqtMqbpuzfVDFJtsggM7SXpcySw= X-User-ID: U2FsdGVkX18TvgTVWuqw+kveIs84pR2/hXHS3ioXouy28BY8Bgq1eQ== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Thomas 'PointedEars' Lahn has brought this to us : >> Jupi wrote: >>> Thomas 'PointedEars' Lahn expressed precisely : >>>>> I need to encode string using Central European Windows-1250 encoding. >>>> Why? >>> Because I need it. >> No, you just *think* you need it. > > Right. I need just solution for my problem. This is not a support forum for Copy & Pray. >> Have you even read this? >>> I just need to encode some string which >>> contains Easteuropean characters to base64 string. >> >> var b64 = window.btoa("Perišić"); > > Result is this: > UGVyacWhacSH In which environment? See my update. > and I need this: > UGVyaZpp5g== Hardly: | > window.atob("UGVyaZpp5g==") | "Perišiæ" > […] >>> Curently, when I encode string, it is encoded using utf-8. >> No, it is not. >> >> How did you get the idea that it would be? > Please check here: http://base64encodedecode.com That is a Web application. If you are asking here, you are asking to do it in your own code instead. > you can select different Encoding. So that is _not_ what I said. Because of the limitations of Base64, they are basically using the same workaround as I did in my update. For example, ć is encoded as xIc= as it is with | > window.btoa(encodeURIComponent("ć").replace(/%([0-9A-F]{2})/g, (m, code) | => String.fromCharCode(parseInt(code, 16)))) | "xIc=" (Our inputs and outputs match; their code is minified, so I will not bother to check further.) -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.