Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.radio.string.convertTo7Bit
on convertTo7Bit (s) {
<<Changes
<<1/28/02; 3:51:32 PM by JS
<<Created. Convert accented characters to their nearest 7-bit equivalent. Used primarily for creating filenames for new files, created via the browser.
local (adrtable);
if system.environment.isMac {
adrtable = @radio.data.convertTo7Bit.mac}
else {
adrtable = @radio.data.convertTo7Bit.windows};
local (s2 = "", ct = sizeOf (s));
for i = 1 to ct {
local (code = string.padWithZeros (number (s[i]), 3));
if defined (adrtable^.[code]) {
s2 = s2 + adrtable^.[code]}};
return (s2)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.