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

后端 未结 2 606
渐次进展
渐次进展 2020-12-15 07:13

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

相关标签:
2条回答
  • 2020-12-15 07:42

    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
    
    0 讨论(0)
  • 2020-12-15 07:45

    This depends on your aggregator. Default sms charset is limited to Latin and some special letters only (including hash mark), others are sent in Unicode or using locking shift table mechanism. But you are using an API to send messages, so all these things are encapsulated. I suggest continuing asking your aggregator for help, they probably block some characters manually.

    @ £ $ ¥ è é ù ì ò Ç Ø ø Å å Δ _ Φ Γ Λ Ω Π Ψ Σ Θ Ξ ^ { } \ [ ~ ] | € Æ æ ß É [ ] ! “ # ¤ % & ‘ ( ) * + , – . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? ¡ 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 ä ö ñ ü à
    ...also special characters like CR LF FF.

    0 讨论(0)
提交回复
热议问题