[Laszlo-dev] UPDATED For Review: Change 20090105-hqm-R Summary: fix url encoding problem
Henry Minsky
hminsky at laszlosystems.com
Tue Jan 6 08:49:11 PST 2009
I like having a single common url escape routine across all runtimes,
it makes debugging simpler.
I just modified your utf8 escape routine to pad the extra zero when needed
var escape_utf8 = function (s:String):String {
var utf8 = "";
for (var i = 0, len = s.length; i < len; ++i) {
var c = s.charCodeAt(i);
if ((c >= 0x30 && c <= 0x39) // 0-9
|| (c >= 0x41 && c <= 0x5A) // A-Z
|| (c >= 0x61 && c <= 0x7A)) {// a-z
utf8 += s.charAt(i);
} else if (c < 0x10) {
// 0xxxxxxx
utf8 += "%0" + (c).toString(16).toUpperCase();
} else if (c <= 0x7F) {
// 0xxxxxxx
utf8 += "%" + (c).toString(16).toUpperCase();
...
...
On Tue, Jan 6, 2009 at 11:49 AM, André Bargull <andre.bargull at udo.edu> wrote:
> As an alternative, we could (maybe should?) use:
> - in swf8: escape
> - in dhtml+swf9: encodeURIComponent [1] with a few modifications so it also
> encodes "- _ . ! ~ * ' ( )" into the appropriate UTF-8 encoding
>
> [1]
> "https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/encodeURIComponent"
>
>
>
> On 1/6/2009 5:29 PM, Henry Minsky wrote:
>>
>> Hang on, there's a bug in the escape_utf8 routine, it's encoding
>> newline as "%A" instead of "%0A", I need
>> to fix that.
>>
>>
>>
>>
>>
>> On Tue, Jan 6, 2009 at 2:19 AM, Henry Minsky <henry.minsky at gmail.com>
>> wrote:
>>>
>>> Change 20090105-hqm-R by hqm at badtzmaru.home on 2009-01-05 19:40:54 EST
>>> in /Users/hqm/openlaszlo/trunk3/WEB-INF/lps/lfc
>>> for http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc
>>>
>>> Summary: fix url encoding problem
>>>
>>> New Features:
>>>
>>> Bugs Fixed: LPP-7532
>>>
>>> Technical Reviewer: andre
>>> QA Reviewer: ptw
>>> Doc Reviewer: (pending)
>>>
>>> Documentation:
>>>
>>> Release Notes:
>>>
>>> The recommended way to url-escape strings is to call
>>> lz.Browser.urlEscape.
>>> This works similar to the Javascript encodeURIComponent function, but is
>>> preferable
>>> because there are some knows bugs with encodeURIComponent on some
>>> platforms.
>>>
>>> Details:
>>>
>>> Use Andre's utf-8 clean implementation of encodeURIComponent.
>>>
>>> Tests:
>>>
>>> demos/amazon/amazon.lzx in swf8,swf9,dhtml
>>> test/lfc/data/alldata.lzx (alldata.lzx has bugs, but there should be no
>>> regressions from behavior in trunk)
>>> demos/lzpix/app.lzx in swf8,swf9,dhtml
>>> demos/calendar/calendar.lzx in swf8,swf9,dhtml
>>>
>>> Files:
>>> M kernel/swf/LzLoadQueue.as
>>> M services/LzBrowser.lzs
>>> M debugger/platform/swf9/LzFlashRemote.as
>>> M data/LzParam.lzs
>>> M compiler/LzRuntime.lzs
>>> M compiler/LzBootstrapDebugService.lzs
>>>
>>> Changeset:
>>> http://svn.openlaszlo.org/openlaszlo/patches/20090105-hqm-R.tar
>>>
>>
>>
>>
>
>
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
More information about the Laszlo-dev
mailing list