Utf8 encoding issue ! UTF8Characters in Invoke function of NPAPI?

69 Views Asked by At

Deal with utf8 encoding issues is really a pain when I make firefox plug-in with NPAPI. Especially when it comes to Invoke function ( Invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result) ). When it gets a call from js, I can get the parameters posted by using the code bellow: std::string strParam = args[0].value.stringValue.UTF8Characters; Here comes the problem! When I sent strParam back to browser or wrote it to a utf8 encoding txt, it turned out all messy codes. Is UTF8Characters not Utf8 encoded string?! If not, is there a way to get a utf8 string from it?

Any helps? I am hungerd for your rescue!

ps: project character-set: Unicode.

0

There are 0 best solutions below