summaryrefslogtreecommitdiff
path: root/appl/lib
diff options
context:
space:
mode:
authorforsyth <forsyth@vitanuova.com>2010-09-25 14:04:43 +0100
committerforsyth <forsyth@vitanuova.com>2010-09-25 14:04:43 +0100
commit35f503c642e9dd127a2b989e4e12a10691cba3d4 (patch)
treeacb0a1b5b1d3f242345b5e99d807bfd53ae99fbe /appl/lib
parent9d79870ef4c3926878bf998c10a08c308dc3bd74 (diff)
20100925-1403
Diffstat (limited to 'appl/lib')
-rw-r--r--appl/lib/complete.b1
-rw-r--r--appl/lib/w3c/uris.b28
2 files changed, 17 insertions, 12 deletions
diff --git a/appl/lib/complete.b b/appl/lib/complete.b
index 1a2e7713..b793e8f5 100644
--- a/appl/lib/complete.b
+++ b/appl/lib/complete.b
@@ -41,7 +41,6 @@ complete(dir, s: string): (ref Completion, string)
if(n == 0)
return (nil, nil);
- readdir = nil;
c := ref Completion(0, 0, nil, 0, nil);
diff --git a/appl/lib/w3c/uris.b b/appl/lib/w3c/uris.b
index b49c17b8..07042dc4 100644
--- a/appl/lib/w3c/uris.b
+++ b/appl/lib/w3c/uris.b
@@ -260,20 +260,26 @@ dec(s: string): string
if(s[i] == '%' || s[i] == 0)
break;
}
- o := s[0:i];
+ t := s[0:i];
+ a := array[Sys->UTFmax*len s] of byte; # upper bound
+ o := 0;
while(i < len s){
- case c := s[i++] {
- '%' =>
- if((v := hex2(s[i:])) > 0){
- c = v;
- i += 2;
+ c := s[i++];
+ if(c < 16r80){
+ case c {
+ '%' =>
+ if((v := hex2(s[i:])) > 0){
+ c = v;
+ i += 2;
+ }
+ 0 =>
+ c = ' '; # shouldn't happen
}
- 0 =>
- c = ' '; # shouldn't happen
- }
- o[len o] = c;
+ a[o++] = byte c;
+ }else
+ o += sys->char2byte(c, a, o); # string contained Unicode
}
- return o;
+ return t + string a[0:o];
}
enc1(s: string, safe: string): string