I've written a simple code that finds the first and last name in the URL and returns them as text and I've been using it as titles for personal pages. Everything works perfectly except if name is written in the non-Latin alphabet (in my case Georgian) it returns seemingly random numbers.
if(window.location.href.includes("authorname")) {
var strhtp = window.location.href;
var sbthtp = strhtp .substring(strhtp .indexOf('=') + 1).replaceAll("+", " ");
document.getElementById("filye").innerHTML = sbthtp;
}
<span id="filye"></span>
if URL includes authorname=John+Doe it returns normally, but if name is written in Georgian, for example authorname=ვაჟა+ფშაველა it returns seemingly random numbers:
%E1%83%90%E1%83%9A%E1%83%94%E1%83%A5%E1%83%A1%E1%83%90%E1%83%9C%E1%83%93%E1%83%A0%E1%83%94 %E1%83%99%E1%83%9D%E1%83%91%E1%83%94%E1%83%A0%E1%83%98%E1%83%AB%E1%83%94
The best outcome would be if the code was able to return non-Latin names normally. But if that isn't possible I'd like it if you'd help me to either (a) change all non-Latin characters to Latin equivalents or (b) code to return Latin names as text, but reject non-Latin names altogether and return nothing.
Thank you