[SOLVED] Is UTF8 supported within the used 'JS-version'

Mozilla-aproach fails, when trying this Danish/UTF8-string in the editor:


const uri = 'https://mozilla.org/?x=æøå';
const encoded = encodeURI(uri);
console.log("enc: "+encoded); // works
window.open(encoded, "_self"); // does not work?
  • and also while trying:

window.open(encodeURI(uri), "_self"); // does not work either?

And by not working, I unfortunately don’t get the expected:
… ://mozilla.org/?x=%C3%A6%C3%B8%C3%A5

JS taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI

hmmm … now it gets a bit weird - this rewrite tries to induce my suspicion of a weird built-in conversion by the window.open:

const uri = 'https://mozilla.org/?x=%C3%A6%C3%B8%C3%A5';            
const encoded = encodeURI(uri); 
var stringEncEnc = ""+encoded; 
window.open(stringEncEnc, "_self");

The result points in the direction of a conversion taking place, as the opened website end becomes:

mozilla.org/da/?x=æøå

unless anybody has a good hunch, I will close this soon, as the issue seem to lay within the realm of the Chrome browser … need a different approach totally (will look into researching other browser conversion policies etc.)


edit: covering 95% of the world most used browsers (Chrome, Safari, Firefox, Samsung Internet and Opera), they all transfer letters ‘æøå’ without troublelling conversion at ‘end-url’. Previously, this was an issue years ago, but seems like all major browsers now support (at least local - cf below) charsets. I do not see it as a problem, if my Danish users are to write in local letters in a PC-textfield, for then to be used in address bar.

Taken from the wikisource https://en.wikipedia.org/wiki/Unicode_and_HTML#Encoding_defaults:
" Encoding defaults

An encoding default applies when there is no external or internal encoding declaration and also no Byte order mark. While the encoding default for HTML pages served as XML is required to be UTF-8, the encoding default for a regular Web page (that is: for HTML pages serialized as text/html) varies depending on the localization of the browser. For a system set up mainly for Western European languages, it will generally be Windows-1252. For Cyrillic alphabet locales, the default is typically Windows-1251. For a browser from a location where legacy multi-byte character encodings are prevalent, some form of auto-detection is likely to be applied."

I should be able to rely on that effect worldwide, and as such I will set this as [SOLVED] (by myself)

Looks like it works to me

It’s probably browsers just recognising the encoding and when it navigates to the new page, it shows you the human readable version.

ok, thx - yes that is also a possible scenario (browser showing readable string). In any case I should be able to use this within a AddressBar-microDB setup - as long as I am “_self”-ing to my own domain (the different browsers seem to have anti SQL-injection measures [link-ends are eliminated], when crossing from one to another domain)