Looking for a list of valid characters that can be sent in sms text messages

changokun picture changokun · Mar 3, 2011 · Viewed 13.5k times · Source

I've been working with an SMS aggregator's web api to send and receive text messages. Not all characters are valid, and when I attempt to send a message with, say, a hash mark # it fails.

I need to clean the strings before I send them but I cannot find a valid list of what characters are good. Mr. Google isn't much help - maybe i'm looking for the wrong terms.

I have already scoured the api manual, and have emailed the company with my question, but there are no answers.

I expect that different phones can handle different lists of characters... eg an iPhone should handle a wide range of characters, but my old nokia flip phone will probably only handle a couple dozen characters beyond the alphanumeric. I'll need the lowest common denominator.

Answer

Technetium picture Technetium · Apr 28, 2012

This is built entirely off of @vissi's answer, but this is something you should be able to plug in if you want to build a small collection into your application for verification purposes.

// Standard Latin Characters
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',

// Numbers
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',

// Punctuation
'!', '#', ' ', '"', '%', '&', '\'', '(', ')', '*', ',', '.', '?',
'+', '-', '/', ';', ':', '<', '=', '>', '¡', '¿', '_', '@',

// Currency
'$', '£', '¥', '\u00A4', // [UNTYPED] CURRENCY SIGN

// Accented Characters
'è', 'é', 'ù', 'ì', 'ò', 'Ç', 'Ø', 'ø', 'Æ', 'æ', 'ß', 'É', 'Å',
'å', 'Ä', 'Ö', 'Ñ', 'Ü', '§', 'ä', 'ö', 'ñ', 'ü', 'à',

// Greek Characters
'\u0394', // GREEK CAPITAL LETTER DELTA
'\u03A6', // GREEK CAPITAL LETTER PHI
'\u0393', // GREEK CAPITAL LETTER GAMMA
'\u039B', // GREEK CAPITAL LETTER LAMBDA
'\u03A9', // GREEK CAPITAL LETTER OMEGA
'\u03A0', // GREEK CAPITAL LETTER PI
'\u03A8', // GREEK CAPITAL LETTER PSI
'\u03A3', // GREEK CAPITAL LETTER SIGMA
'\u0398', // GREEK CAPITAL LETTER OMEGA
'\u039E', // GREEK CAPITAL LETTER XI

// Other Miscellaneous Characters
'\u001B', // ESCAPE
    '\n', // NEW LINE or LINE FEED
    '\r'  // CARRIAGE RETURN