Imagine this:
-User types something in a Unicode Alphabet inside the form field.
–Clicks “SUBMIT”
—Invisibly, in the back, a JavaScript fires and transliterates the form field, converting the Unicode letters into their corresponding Latin transliterates. I have a dictionary for the conversion.
Does such a thing exist, and if it doesn’t, could you make such a thing?
]]>I am looking for a universal solution… I wish I had a WordPress plugin, which could attach my Transliteration javaScript to any <TEXTAREA> fields on my website.
So, that when users submit the form containing the <TEXTAREA>, the script will transliterate the contents of the <TextArea> and only after this will the form be submitted and the romanized Unicode Alphabet characters will enter the database in place of the user’s original input made in Unicode Alphabet symbols.
]]>document.forms.all.onsubmit=function()
{
//Transliteration takes place
};
Will this work?
]]>Incidentally, WP has a similar PHP function: remove_accents(). It’s used to compose post slugs. It’s possible to do this server side in PHP.
You’re likely aware, but it’s worth pointing out that the saved data is still UTF-8 encoded even if it is transformed to basic Latin chars. Actually changing the encoding to ANSI or whatever is inadvisable.
]]>Actually changing the encoding to ANSI or whatever is inadvisable.
Yes, I know that an ANSI database will have only 256 characters to work with…
That’s the point.
I learned that ANSI characters take probably 0.5 – 1 byte. And Unicode is a bit more complex, on the other hand.
Therefore, it makes sense to me to do the following:
1. Let the user enter Unicode on the Front-End.
2. onSubmit, a JavaScript transforms the User’s input to Romanized characters.
3. The input from above enters the database as Roman letters and symbols.
When a user opens the website
1. WordPress pulls from the database the Romanized characters
2. JavaScript runs in the browser (I have it) and translates the Front-End of the site back to the native Unicode Alphabet script of my target users.
My users know nothing about this. To them, the site functions normally, in their native tongue.
To me, the ANSI database is way faster and smaller and less resource-intensive.
I transfer basically the Unicode overhead to the users’ browsers through the use of Transliteration and JavaScript.
What do you think?
]]>Depends on the code you put in the function. Without knowing which forms plugins you want your solution to work with we won’t be able to help you because we don’t know where the data is stored in the database.
Why would you ever work with the DB itself?
The point is that the JavaScript, which runs in the user’s browser, will intercept the <input> of the user BEFORE it enters the database. So, we shouldn’t care where the input goes once it has been transliterated by the browser prior to entering the DB.
The point is through the use of JavaScript, to transfer the overhead to the user. Otherwise, it doesn’t make sense.
]]>