remove accents in SMS

This commit is contained in:
Milos Kozak 2016-09-02 09:43:38 +02:00
parent 9f9d348c11
commit ff32764375
2 changed files with 9 additions and 3 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View file

@ -12,6 +12,7 @@ import com.squareup.otto.Subscribe;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.text.Normalizer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -226,11 +227,16 @@ public class SmsCommunicatorPlugin implements PluginBase {
bolusWaitingForConfirmation = null; bolusWaitingForConfirmation = null;
newSms.processed = true; newSms.processed = true;
} }
smsManager.sendTextMessage(newSms.phoneNumber, null, newSms.text, null, null); smsManager.sendTextMessage(newSms.phoneNumber, null, stripAccents(newSms.text), null, null);
messages.add(newSms); messages.add(newSms);
} }
MainApp.bus().post(new EventSmsCommunicatorUpdateGui()); MainApp.bus().post(new EventSmsCommunicatorUpdateGui());
} }
public static String stripAccents(String s)
{
s = Normalizer.normalize(s, Normalizer.Form.NFD);
s = s.replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
return s;
}
} }