View Full Version : Modifying a textfield value (easy) based on user input: charset->ansi conv.
ItsMeOnly
01-26-2008, 11:22 PM
I need a script that converts user input (including spaces, diacritical chars) to simple ansi string (as to be used in URLs for example). While getting the value and passing one to an input is easy- I'm stuck with the conversion problem.
jscheuer1
01-27-2008, 04:41 AM
You may want to have a look here:
http://centricle.com/tools/ascii-hex/
There are also the javascript methods:
encodeURI()
and:
encodeURIComponent()
and their respective decode counterparts.
ItsMeOnly
01-27-2008, 09:46 AM
Yes, but that keeps the diacritics- just encodes them. I need to replace them with their respective alphabet "root", so like: ą becomes a, ę becomes e etc.
Something tells me that without translation "table" I won't be able to do it :(
jscheuer1
01-27-2008, 05:31 PM
That wasn't clear to me before, I thought you wanted to maintain the characters. A translation table of sorts would be required, however it might be possible to employ ranges of numeric values, in that characters represented by a certain range of their ASCII or perhaps Unicode values could be acted upon with an algorithm to get their values as 'normal' characters. Or, since certain groups of 'high' characters would all translate to the same 'low' character, it could be approached that way. I'd do a search for tables and algorithms for doing just this before making my own.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.