I am generating a url (for facebook dialog) from flash:
var lvs_url = "http://www.facebook.com/dialog/feed?app_id=208524139202627&name=š š&caption=&description=&link=http://apps.facebook.com/celjska_puzzle&redirect_uri=http://apps.facebook.com/celjska_puzzle/"
var lvo_req : URLRequest = new URLRequest( lvs_url ) ;
navigateToURL( lvo_req , "_blank" );
but by the time that url makes it to the browser, the š's have been turned into %9A's, which then show up as ?-diamond's in the facebook pop up.
However, the browser is ok with %20's
here is the encoded url: http://www.facebook.com/dialog/feed?app_id=208524139202627&name=%9A%20%9A&caption=&description=&link=http://apps.facebook.com/celjska_puzzle&redirect_uri=http://apps.facebook.com/celjska_puzzle/
Try encodeURIComponent
:
var lvs_url = "http://www.facebook.com/dialog/feed?app_id=208524139202627&name="+encodeURIComponent("š š")+"&caption=&description=&link=http://apps.facebook.com/celjska_puzzle&redirect_uri=http://apps.facebook.com/celjska_puzzle/";
var lvo_req : URLRequest = new URLRequest( lvs_url ) ;
navigateToURL( lvo_req , "_blank" );
Creates a URLRequest object.
If
System.useCodePage
istrue
, the request is encoded using the system code page, rather than Unicode.If
System.useCodePage
isfalse
, the request is encoded using Unicode, rather than the system code page.
Specification says:
Non-ASCII characters must first be encoded according to UTF-8 [STD63], and then each octet of the corresponding UTF-8 sequence must be percent- encoded to be represented as URI characters.
This means that "š"
must be encoded as %C5%A1
in urls. Try setting System.useCodePage
to false
, even though the documentation is ambiguous because encoded using Unicode doesn't necessarily mean UTF-8
.
I should also mention that your file should be saved in UTF-8
encoding if you are literally using "š"
in the file.