使用 Whatsapp “点击聊天”,我可以按预期向某个号码发送消息。\n但是,我想在预填充消息中发送一些表情符号。当我使用浏览器时它运行良好,但当我在应用程序内使用 WebView 时它不起作用(特别是带有运行同一站点的 WebView 的 React Native 应用程序)。
\n问题:
\n对于桌面浏览器或 webView,我使用相同的功能和相同的编码 ( encodeURI()),但是\n当 WebView 调用 Whatsapp URL(“wa.me/...”)时,Whatsapp 上的聊天将所有表情符号显示为:\xef\xbf\xbd
这是我正在使用的函数:
\nSendWhatsapp = function(message, number) {\n number = LibGeral.NormalizeMobileNumber(number);\n if (empty(message)) {\n message = "";\n }\n\n var urlApiWhats = "https://wa.me/" + number + "?text=" + message;\n urlApiWhats = encodeURI(urlApiWhats);\n var a = document.createElement("a");\n a.setAttribute("data-action", "share/whatsapp/share")\n a.href = urlApiWhats;\n window.document.body.appendChild(a)\n a.click();\n window.document.body.removeChild(a);\n …Run Code Online (Sandbox Code Playgroud)