0

I'm trying to create an chrome extension for a chat on a webpage. I've created a method to post messages into the chat:

function postMsg(msg) {
    var data = {chat_message:msg.trim(), "chat_submit": "Send"}
    console.log(msg);
    $.post("http://example.com/", data);
}

It does not support æåø characters that uft-8 supports. It appear like this: MÃ¥ gÃ¥ and it should look like Må gå.

I've tried to output the var into the console. And it output it how it should be outputted. The chat also support UFT-8.

How should I solve this task?

EDIT: my problem was exacly like descibed here: How do I transcode a Javascript string to ISO-8859-1?

It also solved my problem.

Christian Moen
  • 1,253
  • 2
  • 17
  • 31
  • 1
    Inspect network requests during normal chat activity: there's probably a http header you need to use in your code. – wOxxOm Aug 23 '17 at 04:45
  • Please [edit] the question to be on-topic: include a [mcve] that *duplicates the problem*. For Chrome extensions or Firefox WebExtensions you almost always need to include your *manifest.json* and some of the background, content, and/or popup scripts/HTML, and often webpage HTML/scripts. Questions seeking debugging help ("why isn't my code working the way I want?") must include: (1) the desired behavior, (2) a specific problem or error and (3) the shortest code necessary to reproduce it *in the question itself*. Please also see: [What topics can I ask about here?](/help/on-topic), and [ask]. – Makyen Aug 23 '17 at 22:55
  • In this instance, it's going to be difficult to generate a MCVE. While it doesn't satisfy the requirements for questions on SO, linking in comments to the page you are interacting with may allow others to look into the issue. However, what may be needed is for you to provide network traces in the question (i.e. include the HTTP headers which are used by the site). – Makyen Aug 23 '17 at 22:58
  • This solved my problem https://stackoverflow.com/questions/2283829/how-do-i-transcode-a-javascript-string-to-iso-8859-1 – Christian Moen Aug 23 '17 at 23:58

0 Answers0