- Timestamp:
- 2014-02-03T18:07:45+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r6749 r6805 5 5 6 6 import java.awt.Color; 7 import java.io.UnsupportedEncodingException; 7 8 import java.lang.annotation.ElementType; 8 9 import java.lang.annotation.Retention; … … 12 13 import java.lang.reflect.InvocationTargetException; 13 14 import java.lang.reflect.Method; 15 import java.net.URLEncoder; 14 16 import java.util.ArrayList; 15 17 import java.util.Arrays; … … 524 526 return s == null ? null : s.replace(target, replacement); 525 527 } 528 529 /** 530 * Percent-encode a string. (See https://en.wikipedia.org/wiki/Percent-encoding) 531 * This is especially useful for data urls, e.g. 532 * <code>icon-image: concat("data:image/svg+xml,", URL_encode("<svg>...</svg>"));</code> 533 * @param s arbitrary string 534 * @return the encoded string 535 */ 536 public static String URL_encode(String s) { 537 try { 538 return s == null ? null : URLEncoder.encode(s, "UTF-8"); 539 } catch (UnsupportedEncodingException ex) { 540 throw new RuntimeException(); 541 } 542 } 526 543 } 527 544
Note:
See TracChangeset
for help on using the changeset viewer.