Skip to content

Commit 9a85ef9

Browse files
Fix chinese character issue
1 parent 9efaf21 commit 9a85ef9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

HsDropbox/src/org/hamster/dropbox/DropboxClient.as

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ package org.hamster.dropbox
9393
*/
9494
public class DropboxClient extends EventDispatcher
9595
{
96+
public static const CHARACTER_ENCODING_MAPPING:Array = [
97+
{charFrom : '#', charTo : '%23'},
98+
{charFrom : '$', charTo : '%24'},
99+
{charFrom : '(', charTo : '%28'},
100+
{charFrom : ')', charTo : '%29'},
101+
{charFrom : "'", charTo : '%27'},
102+
{charFrom : "@", charTo : '%40'},
103+
{charFrom : "+", charTo : '%2B'},
104+
];
105+
96106
protected static const REQUEST_TOKEN:String = 'request_token';
97107
protected static const ACCESS_TOKEN:String = 'access_token';
98108
protected static const ACCOUNT_INFO:String = 'account_info';
@@ -803,7 +813,11 @@ package org.hamster.dropbox
803813
{
804814
var paths:Array = url.split('/');
805815
for (var i:int = 0; i < paths.length; i++) {
806-
paths[i] = escape(paths[i]).split('@').join("%40").split("+").join("%2B");
816+
var str:String = encodeURI(paths[i]);
817+
for each (var charObj:Object in CHARACTER_ENCODING_MAPPING) {
818+
str = str.split(charObj.charFrom).join(charObj.charTo);
819+
}
820+
paths[i] = str;
807821
}
808822
return paths.join('/');
809823
}

0 commit comments

Comments
 (0)