mirror of
https://github.com/zxing/zxing.git
synced 2025-01-29 03:53:28 -08:00
Issue 1061 URL-escape {CODE} replacement
git-svn-id: https://zxing.googlecode.com/svn/trunk@2034 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
157f2a2449
commit
b6ac1adae2
|
@ -62,6 +62,8 @@ import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -578,8 +580,13 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
|
||||||
// with the scanned code. This allows both queries and REST-style URLs to work.
|
// with the scanned code. This allows both queries and REST-style URLs to work.
|
||||||
if (returnUrlTemplate != null) {
|
if (returnUrlTemplate != null) {
|
||||||
Message message = Message.obtain(handler, R.id.launch_product_query);
|
Message message = Message.obtain(handler, R.id.launch_product_query);
|
||||||
message.obj = returnUrlTemplate.replace(RETURN_CODE_PLACEHOLDER,
|
String codeReplacement = String.valueOf(resultHandler.getDisplayContents());
|
||||||
String.valueOf(resultHandler.getDisplayContents()));
|
try {
|
||||||
|
codeReplacement = URLEncoder.encode(codeReplacement, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
// can't happen; UTF-8 is always supported. Continue, I guess, without encoding
|
||||||
|
}
|
||||||
|
message.obj = returnUrlTemplate.replace(RETURN_CODE_PLACEHOLDER, codeReplacement);
|
||||||
handler.sendMessageDelayed(message, INTENT_RESULT_DURATION);
|
handler.sendMessageDelayed(message, INTENT_RESULT_DURATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue