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.
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.
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.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
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![]()
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.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks