收藏
回答

emoji编码困惑,官方貌似自己实现了一套emoji编码

授权使用post,“application/x-www-form-urlencoded;“, 传数据 后台获取到的昵称,部分正常,部分乱码,找不出来解决办法,部分用户昵称会出现“这个字符(大部分情况集中在vivo,oppo,mi手机上)


服务器打印出来有问题的字符串, 例如,其中“%EE%90%99”是客户端发送过来的encodeURIComponent(用户昵称)


我选择复制 这个到微信pc客户端,能正常显示“👀”,也就是微信pc客户端能将“EE 90 99”解析成“👀”,但是这个utf-8编码的emoji实际是“f0 9f 91 80”,

所以为什么原本encodeURIComponent(👀) == “%f0%9f%91%80”, 而客户端传回的是“%EE%90%99”, 是否微信客户端默认做了一套emoji编码集,来处理一些兼容情况,如果是的话,能否把这个告知开发者


最后一次编辑于  2018-09-07  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏投诉关注问题回答

17 个回答

  • 王迪
    王迪
    2018-09-07

    自己顶

    2018-09-07
    赞同
    回复 1
    • 王迪
      王迪
      2018-09-07

      {

      "%EE%80%83": "💋",

      "%EE%80%8A": "📱",

      "%EE%80%8D": "👊",

      "%EE%80%91": "✌",

      "%EE%80%99": "🐟",

      "%EE%80%9A": "🐴",

      "%EE%80%9C": "⛵",

      "%EE%80%9D": "✈",

      "%EE%80%A1": "❗",

      "%EE%80%A2": "❤",

      "%EE%80%A3": "💔",

      "%EE%80%B0": "🌸",

      "%EE%80%B2": "🌹",

      "%EE%80%B3": "🎄",

      "%EE%80%B4": "💍",

      "%EE%80%B5": "💎",

      "%EE%80%B6": "🏠",

      "%EE%80%BE": "🎵",

      "%EE%81%81": "🎸",

      "%EE%81%86": "🍰",

      "%EE%81%88": "⛄",

      "%EE%81%89": "☁",

      "%EE%81%8A": "☀",

      "%EE%81%8B": "☔",

      "%EE%81%8C": "🌙",

      "%EE%81%8F": "🐱",

      "%EE%81%90": "🐯",

      "%EE%81%92": "🐶",

      "%EE%81%93": "🐭",

      "%EE%81%94": "🐳",

      "%EE%81%96": "😊",

      "%EE%81%97": "😃",

      "%EE%81%99": "😠",

      "%EE%81%9A": "💩",

      "%EE%84%85": "😜",

      "%EE%84%86": "😍",

      "%EE%84%8A": "🐙",

      "%EE%84%8B": "🐷",

      "%EE%84%8D": "🚀",

      "%EE%84%8E": "👑",

      "%EE%84%90": "🍀",

      "%EE%84%93": "🔫",

      "%EE%84%95": "🏃",

      "%EE%84%98": "🍁",

      "%EE%84%99": "🍂",

      "%EE%84%9A": "👿",

      "%EE%84%9B": "👻",

      "%EE%84%9D": "🔥",

      "%EE%84%AC": "〽",

      "%EE%84%AF": "💰",

      "%EE%84%B6": "🚲",

      "%EE%84%B9": "🚺",

      "%EE%84%BB": "💉",

      "%EE%84%BC": "💤",

      "%EE%84%BD": "⚡",

      "%EE%84%BE": "👠",

      "%EE%85%8C": "💪",

      "%EE%88%81": "🚶",

      "%EE%88%84": "💟",

      "%EE%88%8C": "♥",

      "%EE%88%9F": "4⃣",

      "%EE%88%B0": "👈",

      "%EE%88%B1": "👉",

      "%EE%88%B6": "↗",

      "%EE%88%B7": "↖",

      "%EE%89%8E": "©",

      "%EE%89%8F": "®",

      "%EE%89%93": "💁",

      "%EE%8C%81": "📝",

      "%EE%8C%83": "🌺",

      "%EE%8C%84": "🌷",

      "%EE%8C%85": "🌻",

      "%EE%8C%86": "💐",

      "%EE%8C%87": "🌴",

      "%EE%8C%8D": "㊗",

      "%EE%8C%90": "🎈",

      "%EE%8C%92": "🎉",

      "%EE%8C%94": "🎀",

      "%EE%8C%98": "👒",

      "%EE%8C%9C": "💄",

      "%EE%8C%9D": "💅",

      "%EE%8C%A2": "👙",

      "%EE%8C%A4": "🎬",

      "%EE%8C%A6": "🎶",

      "%EE%8C%A7": "💓",

      "%EE%8C%A8": "💗",

      "%EE%8C%A9": "💘",

      "%EE%8C%AA": "💙",

      "%EE%8C%AB": "💚",

      "%EE%8C%AC": "💛",

      "%EE%8C%AD": "💜",

      "%EE%8C%AE": "✨",

      "%EE%8C%AF": "⭐",

      "%EE%8C%B0": "💨",

      "%EE%8C%B1": "💦",

      "%EE%8C%B3": "❌",

      "%EE%8C%B5": "🌟",

      "%EE%8C%BA": "🍦",

      "%EE%8C%BC": "🍡",

      "%EE%8D%85": "🍏",

      "%EE%8D%86": "🍊",

      "%EE%8D%87": "🍓",

      "%EE%8D%88": "🍉",

      "%EE%8D%8B": "🎂",

      "%EE%90%82": "😏",

      "%EE%90%8A": "😌",

      "%EE%90%8B": "😨",

      "%EE%90%8C": "😷",

      "%EE%90%90": "😲",

      "%EE%90%92": "😂",

      "%EE%90%95": "😄",

      "%EE%90%98": "😘",

      "%EE%90%99": "👀",

      "%EE%90%9B": "👂",

      "%EE%90%9C": "👄",

      "%EE%90%9D": "🙏",

      "%EE%90%9F": "👏",

      "%EE%90%A0": "👌",

      "%EE%90%A3": "🙅",

      "%EE%90%A4": "🙆",

      "%EE%90%A8": "👫",

      "%EE%90%A9": "👯",

      "%EE%90%B7": "💝",

      "%EE%90%B9": "🎓",

      "%EE%90%BB": "🎏",

      "%EE%90%BE": "🌊",

      "%EE%90%BF": "🍧",

      "%EE%91%84": "🌾",

      "%EE%91%85": "🎃",

      "%EE%91%87": "🍃",

      "%EE%91%88": "🎅",

      "%EE%91%89": "🌅",

      "%EE%91%8A": "🌇",

      "%EE%91%8C": "🌈",

      "%EE%94%82": "🎨",

      "%EE%94%83": "🎩",

      "%EE%94%85": "🏯",

      "%EE%94%93": "🇨🇳",

      "%EE%94%99": "👵",

      "%EE%94%9C": "👸",

      "%EE%94%9E": "💂",

      "%EE%94%9F": "💃",

      "%EE%94%A0": "🐬",

      "%EE%94%A1": "🐦",

      "%EE%94%A2": "🐠",

      "%EE%94%A4": "🐹",

      "%EE%94%A8": "🐒",

      "%EE%94%AB": "🐮",

      "%EE%94%AC": "🐰",

      "%EE%94%AD": "🐍",

      "%EE%94%AE": "🐔",

      "%EE%94%B6": "👣",

      "%EE%A0%90": "",

      "%EE%A0%BA": "",

      }


      2018-09-07
      赞同
      回复
  • 是柿子啊
    是柿子啊
    2018-09-07

    你好,目前 Android 小程序上确实是只显示 Android 支持的 Emoji,微信表情只显示字符

    2018-09-07
    赞同
    回复 5
    • 王迪
      王迪
      2018-09-07

      那我应该如何处理这个情况呢?比如,用户a(android)给用户b(ios)评论,但是用户b看到用户a的昵称就会是不正常的字符串啊。

      2018-09-07
      赞同
      回复
    • 是柿子啊
      是柿子啊
      2018-09-07回复王迪

      建议使用正则判断,然后做一下处理

      2018-09-07
      赞同
      回复
    • 王迪
      王迪
      2018-09-07

      “%EE%90%99”对应的“👀”是有相应的utf-8编码的“%f0%9f%91%80”,如果给我所有微信特殊emoji编码和标准emoji编码映射表的话,我统一转化为utf-8标准的编码,这样的话,应该没问题的。

      2018-09-07
      赞同
      回复
    • 王迪
      王迪
      2018-09-07回复是柿子啊

      正则判断的意思是过滤掉?有些用户就一个表情,过滤就没了。

      2018-09-07
      赞同
      回复
    • 王迪
      王迪
      2018-09-21

      麻烦看下这个问题

      https://developers.weixin.qq.com/community/develop/doc/0002ac8dac4a20cb4a6747dbe51800

      2018-09-21
      赞同
      回复
  • 🇻 🇰 🇮 🇳 🇬ʷᵃⁿᵍ
    🇻 🇰 🇮 🇳 🇬ʷᵃⁿᵍ
    2018-09-07

    数据表存储 emoji 用 utf8mb4 比较合适,“application/x-www-form-urlencoded;“  不行就换 multipart/form-data 试试

    2018-09-07
    赞同
    回复 1
    • 王迪
      王迪
      2018-09-07

       utf8mb4我设置了的,部分机型emoji  编码有问题,用的不是标准编码

      2018-09-07
      赞同
      回复
  • Krasen
    Krasen
    2018-09-10

    不要直接使用 post 过来的用户信息,请使用 rawData 进行解密,然后做存储,这样就不会出现头像中的 emoji 表情被编码的问题了,而且从安全角度来说,也不建议直接使用 post 中的用户信息字段,因为这种用户信息可能会被伪造

    2018-09-10
    赞同
    回复 1
    • 王迪
      王迪
      2018-09-10

      是解密rawData处理的。 emoji乱码是另外的问题,我目前是替换处理。

      2018-09-10
      赞同 11
      回复
  • 零
    2018-09-10

    占位

    2018-09-10
    赞同
    回复
  • D.K
    D.K
    2018-09-10

    马克

    2018-09-10
    赞同
    回复
  • Anna Lu夜战八方哒叭将
    Anna Lu夜战八方哒叭将
    2018-10-18

    同有问题 用的wafer小程序解决方案 emoji完全读不出来 没有办法post到MySQL上(已经设置过各种utf8mb4)。。。解码解得挺奇怪的 而且每次报错都说

    ER_TRUNCATED_WRONG_VALUE_FOR_FIELD: Incorrect string value: '\xF0\x9F\x90\x9F' for column 'nickName' at row 1

    不知道到底是怎么了呢

    2018-10-18
    赞同
    回复 2
    • Anna Lu夜战八方哒叭将
      Anna Lu夜战八方哒叭将
      2018-10-19

      没事了我这种的问题解决了 我是用wafer解决方案的 各种设置utf8mb4  就需要把connection的charset设置为utf8mb4,不仅要把初次登录的设置好,也要把initMysqlPool()里charset也设置好

      2018-10-19
      赞同
      回复
    • 王迪
      王迪
      2018-10-26回复Anna Lu夜战八方哒叭将

      没搞过wafer。。。

      2018-10-26
      赞同
      回复