Recently, an amusing phenomenon came up on Facebook: a page that claimed — with a live example to back it up — to let you type words upside down. When I saw it, I was intrigued, so I became a “fan”. Later, when I actually followed the link to see how it all worked, I realized that it used some quirky Unicode to as a gimmick to get people to go to a gaming website, or to try to get people to divulge personal information about themselves. So, I unlinked my Facebook persona from the page and deleted the post I’d made earlier, lest others get ensnared in an information collection trap of some kind.
However, in the process, I found the table of characters that they were using to generate the upside down characters, and this is really kind of interesting. Anyone with rudimentary programming skills should be able to implement this, or you could just type the characters in by hand if you prefer.
function flip() {
var result = flipString(document.f.original.value);
document.f.flipped.value = result;
}
function flipString(aString) {
aString = aString.toLowerCase();
var last = aString.length - 1;
var result = "";
for (var i = last; i >= 0; --i) {
result += flipChar(aString.charAt(i))
}
return result;
}
function flipChar(c) {
if (c == 'a') {
return '\u0250'
}
else if (c == 'b') {
return 'q'
}
else if (c == 'c') {
return '\u0254'
}
else if (c == 'd') {
return 'p'
}
else if (c == 'e') {
return '\u01DD'
}
else if (c == 'f') {
return '\u025F'
}
else if (c == 'g') {
return 'b'
}
else if (c == 'h') {
return '\u0265'
}
else if (c == 'i') {
return '\u0131'//'\u0131\u0323'
}
else if (c == 'j') {
return 'ɾ'
}
else if (c == 'k') {
return '\u029E'
}
else if (c == 'l') {
return '\u05DF'
}
else if (c == 'm') {
return '\u026F'
}
else if (c == 'n') {
return 'u'
}
else if (c == 'o') {
return 'o'
}
else if (c == 'p') {
return 'd'
}
else if (c == 'q') {
return 'b'
}
else if (c == 'r') {
return '\u0279'
}
else if (c == 's') {
return 's'
}
else if (c == 't') {
return '\u0287'
}
else if (c == 'u') {
return 'n'
}
else if (c == 'v') {
return '\u028C'
}
else if (c == 'w') {
return '\u028D'
}
else if (c == 'x') {
return 'x'
}
else if (c == 'y') {
return '\u028E'
}
else if (c == 'z') {
return 'z'
}
else if (c == '[') {
return ']'
}
else if (c == ']') {
return '['
}
else if (c == '(') {
return ')'
}
else if (c == ')') {
return '('
}
else if (c == '{') {
return '}'
}
else if (c == '}') {
return '{'
}
else if (c == '?') {
return '\u00BF'
}
else if (c == '\u00BF') {
return '?'
}
else if (c == '!') {
return '\u00A1'
}
else if (c == "\'") {
return ','
}
else if (c == ',') {
return "\'"
}
return c;
}







