【问题标题】:EncodeURIComponent/DecodeURIComponent with characters like "é"EncodeURIComponent/DecodeURIComponent 带有“é”等字符
【发布时间】:2017-03-13 15:07:18
【问题描述】:

我有一个 Web 应用程序,带有一些下拉列表。 其中一个列表有一些带有重音符号的参数,例如:"Bonjour/COUCOU SPéCIALISTE/AB12345"

所以当我选择它并进行研究时,我最终得到了以下网址:

abcdefgh.com/someFunction?way=null&motive=bonjour%2Fcoucou+spécialiste%2FAB12345

在我的功能中,我有:

var somethingPercentage = getSomethingPercentage(
    decodeURIComponent(queryParams.way),
    decodeURIComponent(queryParams.motive)
);

而且,在一个配置文件中,我做了这样的匹配参数:

"bonjour/coucou+spécialiste/ab12345": 0.01

结果,我打错了电话。 但是当我选择一些没有重音的参数时,就没有这个问题了,结果还不错。

如果参数有一些空格,问题是一样的。

为什么会发生这种行为?

【问题讨论】:

    标签: javascript angularjs node.js encode urlencode


    【解决方案1】:

    我刚刚找到。

    我刚刚放了

    logger.info(decodeURIComponent(queryParams.motive));
    

    在以下代码之后:

    var somethingPercentage = getSomethingPercentage(
    decodeURIComponent(queryParams.way),
    decodeURIComponent(queryParams.motive));
    

    现在,我找到了匹配的必要值。

    就我而言,这不是“é”的问题,而是空间的问题。

    【讨论】:

      猜你喜欢
      • 2011-11-09
      • 2015-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-22
      • 2010-12-25
      • 2011-12-26
      • 2013-08-04
      相关资源
      最近更新 更多