remove accents in SMS
This commit is contained in:
parent
9f9d348c11
commit
ff32764375
2 changed files with 9 additions and 3 deletions
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</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" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.squareup.otto.Subscribe;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.Normalizer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -226,11 +227,16 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
bolusWaitingForConfirmation = null;
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue