Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi,

I am sending automated sms messages to customers and as we would like to keep the amount of sms sent to a minimum and avoid sending them with UCS-2 encoding i was looking for a way to replace the characters that arnt in GSM with similar characters.

For instance elongated hyphens — , i would like to replace these with - standard hyphens.

I was just wondering if there was a something i could use to convert it without getting lots of invalid characters or just removing them and putting blank spaces in.

Anyone know of anything that can do the trick?

Otherwise i guess i'll have to make something that does it.

Regards
Carl
Posted

I'm not aware of a library that does this, although it's definitely worth a search if you haven't already. It's simple enough to write, all you need is to call string.Replace repeatedly with the character you don't like and the one you want to replace it with (e.g. text = text.Replace('–', '-')) and then, when you've done all the replacements you know about, go through the string and replace any characters that aren't valid for GSM (not sure what that is but I guess ANSI-256?) with a placeholder, like '_' or '?'.
 
Share this answer
 
v2
I've gone down the route of putting it all in myself, that seems to be the only solution with no library available to do it for me.

It's hardly any code but it took a couple of tedious hours finding which characters arnt in GSM and swapping them out where appropiate.

Thanks for the response BobJanova.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Jun-14 11:16am    
Not an answer. Such posts are considered as abuse. Please move it to a comment to the post by BobJanova.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900