← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10041: Proper URL encoding of message when using Simplistic HTTP Gateway (take 2)

 

------------------------------------------------------------
revno: 10041
committer: Magnus Korvald <korvald@xxxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2013-03-07 13:53:46 +0100
message:
  Proper URL encoding of message when using Simplistic HTTP Gateway (take 2)
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	2013-03-07 11:31:48 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/smslib/SimplisticHttpGetGateWay.java	2013-03-07 12:53:46 +0000
@@ -118,7 +118,7 @@
 
         Map<String, String> requestParameters = new HashMap<String, String>( parameters );
 
-        requestParameters.put( MESSAGE, URLEncoder.encode( msg.getText(), "UTF-8" ) );
+        requestParameters.put( MESSAGE, msg.getText() );
         requestParameters.put( RECIPIENT, msg.getRecipient() );
         String sender = msg.getFrom();
         if ( sender != null )
@@ -128,9 +128,8 @@
         }
         try
         {
-            ResponseEntity<String> response = restTemplate.getForEntity( urlTemplate, String.class, requestParameters );
-
-            if ( response.getStatusCode().series() != HttpStatus.Series.SUCCESSFUL )
+            ResponseEntity<String> response = restTemplate.getForEntity( urlTemplate, String.class, requestParameters, "UTF-8" );
+            if ( response.getStatusCode().series() != HttpStatus.Series.SUCCESSFUL )    
             {
                 Logger.getInstance().logWarn( "Couldn't send message, got response " + response, null, getGatewayId() );
                 return false;