diff --git a/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java index e2b6c3d2a..5996e55c5 100644 --- a/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java +++ b/httpclient/src/main/java/org/apache/http/client/utils/URLEncodedUtils.java @@ -332,7 +332,7 @@ public class URLEncodedUtils { if (safechars.get(b)) { buf.append((char) b); } else { - if (b == ' ' && blankAsPlus) { + if (blankAsPlus && b == ' ') { buf.append('+'); } else { buf.append("%"); @@ -377,7 +377,7 @@ public class URLEncodedUtils { bb.put((byte) uc); bb.put((byte) lc); } - } else if (c == '+' && plusAsBlank) { + } else if (plusAsBlank && c == '+') { bb.put((byte) ' '); } else { bb.put((byte) c);