← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10037: Proper URL encoding of message when using Simplistic HTTP Gateway

 

------------------------------------------------------------
revno: 10037
committer: Magnus Korvald <korvald@xxxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2013-03-07 12:31:48 +0100
message:
  Proper URL encoding of message when using Simplistic HTTP Gateway
modified:
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java	2012-03-01 08:56:47 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java	2013-03-07 11:31:48 +0000
@@ -28,6 +28,7 @@
  */
 
 import java.io.IOException;
+import java.net.URLEncoder;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -58,7 +59,9 @@
  * </ul>
  * 
  * An example usage with bulksms.com would be this template:<br/>
- * http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username={username}&amp;password={password}&amp;message={message}&amp;msisdn={recipient}<br/>
+ * http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0?username={
+ * username
+ * }&amp;password={password}&amp;message={message}&amp;msisdn={recipient}<br/>
  * With the following parameters provided:
  * <ul>
  * <li>username
@@ -115,7 +118,7 @@
 
         Map<String, String> requestParameters = new HashMap<String, String>( parameters );
 
-        requestParameters.put( MESSAGE, msg.getText() );
+        requestParameters.put( MESSAGE, URLEncoder.encode( msg.getText(), "UTF-8" ) );
         requestParameters.put( RECIPIENT, msg.getRecipient() );
         String sender = msg.getFrom();
         if ( sender != null )