View Full Version : UTF8 strings
canard_bleu
11-05-2004, 11:26 AM
Can someone explaing to me what I am supposed to get from
the opGetArtistName and opGetTrackName when UTF-8 is enabled
(version = PLUGIN_API_VERSION_WANTUTF8) ?
I was expecting to get strings like
"title%20of%20song" or similar where non standard chars were
encoded, but it's not the case.
My guess is I misunderstand the way it works. Can someone help me out ?
(more precisely, I am trying to fix the scrobbler plugin where
UNICODE/UTF-8 stuff does not get submitted properly).
Pierre
Tokelil
11-05-2004, 01:12 PM
Im no expert so someone will probably correct me if Im wrong.
What you get is the UTF-8 representation of the unicode string. For more info read:
http://support.microsoft.com/default.aspx?scid=kb;en-us;175392
What I think you need to do is to URLencode your POST string. I did some searching but all I came up with was functions that only works on non-unicode strings. Maybe RJ or Russ can tell you how other plug-ins do it. (Or look at the source for the Winamp plug-in)
There's some more info on urlencoding in this article:
http://www.codeguru.com/Cpp/Cpp/cpp_mfc/article.php/c4029/
Most server classes have functions to do urlencode/urldecode, so maybe finding a server class is the easiest solution.
Tokelil
11-05-2004, 01:18 PM
If you look at the Winamp AS source it has a URLEncode():
http://cvs.sourceforge.net/viewcvs.py/audioscrobbler/wa2plugin/Submission.h?rev=1.3&view=markup
http://cvs.sourceforge.net/viewcvs.py/audioscrobbler/wa2plugin/Submission.cpp?rev=1.5&view=markup
canard_bleu
11-05-2004, 02:14 PM
I get confused between UTF8, UNICODE and URLEncode !
(I am already using the URLEncode function from the scrobbler library)
But there was also a second problem :
I have a C++ class for the QCD functions that stores the service function
pointer in the plugin Entry Point.
The service function pointer actually changes after returning from the entry point (probably to point at the UTF8 version).
I have sorted that out and I am now getting the right data.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.