diff --git a/android/core/src/processing/core/PApplet.java b/android/core/src/processing/core/PApplet.java index 96c1cb80a..d8e66f7f5 100644 --- a/android/core/src/processing/core/PApplet.java +++ b/android/core/src/processing/core/PApplet.java @@ -25,6 +25,8 @@ package processing.core; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; + import android.content.*; import android.content.pm.ActivityInfo; import android.content.res.AssetManager; @@ -34,6 +36,8 @@ import android.graphics.*; import java.io.*; import java.lang.reflect.*; import java.net.MalformedURLException; +import java.net.URLDecoder; +import java.net.URLEncoder; import java.text.NumberFormat; import java.util.*; import java.util.regex.*; @@ -4825,6 +4829,29 @@ public class PApplet extends Activity implements PConstants, Runnable { + ////////////////////////////////////////////////////////////// + + // URL ENCODING + + static public String urlEncode(String what) { + try { + return URLEncoder.encode(what, "UTF-8"); + } catch (UnsupportedEncodingException e) { // oh c'mon + return null; + } + } + + + static public String urlDecode(String what) { + try { + return URLDecoder.decode(what, "UTF-8"); + } catch (UnsupportedEncodingException e) { // safe per the JDK source + return null; + } + } + + + ////////////////////////////////////////////////////////////// // SORT diff --git a/android/todo.txt b/android/todo.txt index 137f5bdb6..440f92a0e 100644 --- a/android/todo.txt +++ b/android/todo.txt @@ -5,7 +5,7 @@ X http://code.google.com/p/processing/issues/detail?id=769 X /opt/android using version #s again? fix build script (earlier) X smooth() is now the default -_ don't let the ... ? +_ lack of registerXxx() implementation is breaking pre() and post() in particles _ focus handling note: _ http://android-developers.blogspot.com/2011/11/making-android-games-that-play-nice.html diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 397a64435..d32f26192 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -6613,6 +6613,29 @@ public class PApplet extends Applet + ////////////////////////////////////////////////////////////// + + // URL ENCODING + + static public String urlEncode(String what) { + try { + return URLEncoder.encode(what, "UTF-8"); + } catch (UnsupportedEncodingException e) { // oh c'mon + return null; + } + } + + + static public String urlDecode(String what) { + try { + return URLDecoder.decode(what, "UTF-8"); + } catch (UnsupportedEncodingException e) { // safe per the JDK source + return null; + } + } + + + ////////////////////////////////////////////////////////////// // SORT diff --git a/todo.txt b/todo.txt index 9de6966a5..0aa373f20 100644 --- a/todo.txt +++ b/todo.txt @@ -38,6 +38,7 @@ X http://code.google.com/p/processing/issues/detail?id=725 X Closing applet window in Processing 1.5 causes serial crash X http://code.google.com/p/processing/issues/detail?id=635 +_ "import processing.xml" throws a missing library error _ renaming a normal tab to same name with ".java" fails with ".pde" version already exists _ http://code.google.com/p/processing/issues/detail?id=776