@@ -30,6 +30,8 @@ public StringRpcServer(Channel channel) throws IOException
3030 public StringRpcServer (Channel channel , String queueName ) throws IOException
3131 { super (channel , queueName ); }
3232
33+ public static String STRING_ENCODING = "UTF-8" ;
34+
3335 /**
3436 * Overridden to do UTF-8 processing, and delegate to
3537 * handleStringCall. If UTF-8 is not understood by this JVM, falls
@@ -39,13 +41,13 @@ public byte[] handleCall(byte[] requestBody, AMQP.BasicProperties replyPropertie
3941 {
4042 String request ;
4143 try {
42- request = new String (requestBody , "UTF-8" );
44+ request = new String (requestBody , STRING_ENCODING );
4345 } catch (UnsupportedEncodingException uee ) {
4446 request = new String (requestBody );
4547 }
4648 String reply = handleStringCall (request , replyProperties );
4749 try {
48- return reply .getBytes ("UTF-8" );
50+ return reply .getBytes (STRING_ENCODING );
4951 } catch (UnsupportedEncodingException uee ) {
5052 return reply .getBytes ();
5153 }
@@ -75,7 +77,7 @@ public String handleStringCall(String request)
7577 public void handleCast (byte [] requestBody )
7678 {
7779 try {
78- handleStringCast (new String (requestBody , "UTF-8" ));
80+ handleStringCast (new String (requestBody , STRING_ENCODING ));
7981 } catch (UnsupportedEncodingException uee ) {
8082 handleStringCast (new String (requestBody ));
8183 }
0 commit comments