Skip to content

Commit

Permalink
Merge pull request #3 from Happyr/bugfix
Browse files Browse the repository at this point in the history
Bugfix
  • Loading branch information
Nyholm committed Feb 11, 2016
2 parents 2ae69b7 + 50226a6 commit 6c6b607
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/com/happyr/mq2php/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.io.IOException;
import java.io.StringReader;
import org.apache.commons.codec.binary.Base64;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -94,6 +96,11 @@ public void addHeader(String key, String value) {
*/
public String serialize(){
byte[] bytes = this.getFormattedMessage().getBytes();
return new String(Base64.encodeBase64(bytes));

try {
return URLEncoder.encode(new String(Base64.encodeBase64(bytes)), "UTF-8");
} catch (UnsupportedEncodingException e) {
return null;
}
}
}

0 comments on commit 6c6b607

Please sign in to comment.