apache-flex - 作为应用程序参数传递时,Flex + 字符被空白替换

标签 apache-flex character-encoding flashvars

我将字符串参数作为 FlashVars 传递到 Flex 应用程序中

参数有时包含特殊字符,除了 + 符号外,一切都显示正常,当它到达 flex 时,它会被空白替换。

这是例如的场景。

我在 JS 中有一个局部变量,它可以获取一些值,对于这个例子,它可以如下所示

<script language="JavaScript" type="text/javascript">   

    var testVar = "some_test_string_that_contains_+_character";

</script>

然后向我的 Flex 对象 AC_FL_RunContent 传递 "FlashVars","test="+testVar

在我编写的应用程序 Init 的 Flex 代码中

var testValue:String = application.parameters["testVar"].toString();
Alert.show(testValue);

现在显示正常,只是 + 字符被空白替换。对于/、@$-_ 等其他字符,不会发生这种情况,但 + 字符会发生这种情况。

任何与此相关的帮助将不胜感激。

最佳答案

来自Adobe's docs :

About flashVars properties encoding

The values of the flashVars properties must be URL encoded. The format of the string is a set of name-value pairs separated by an ampersand (&). You can escape special and nonprintable characters with a percent symbol (%) followed by a two-digit hexadecimal value. You can represent a single blank space using the plus sign (+).

进一步查看 matthew Horn 的评论之一,看起来您可以使用 %2B 来传递 + 字符。

关于apache-flex - 作为应用程序参数传递时,Flex + 字符被空白替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5084628/

相关文章:

apache-flex - Flex中有什么好的向导库吗?

actionscript-3 - AS3错误1180调用IntelliJ中可能未定义的方法

java - Java中的Readline()不能正确处理中文字符

utf-8 - 维基百科上汉字的编码是什么?

java - 为什么Java在调用mxmlc时会抛出IllegalAccessError?

apache-flex - Flexunit 与 Flex Builder 3 中的纯 ActionScript 项目

html - 浏览器如何处理指定字符编码的 &lt;meta&gt; 标签?

apache-flex - 在 flex 的预加载器中访问 flashvars?

actionscript-3 - 在 AS3 中解码 JSON FlashVar

apache-flex - 在 Flex Builder 中测试时传递 flashVars