Solve | problem | Chinese
For the cloud open with AS2 to solve the onID3 of garbled made a little bit of improvement, can be used in MX
Changes:
-Encapsulate a class into a simple function
-Before and after the operation does not change the original System.usecodepage value
Code:
function Ansi2utf (ansi_string) {
var temp =! (! System.usecodepage);
System.usecodepage = true;
var code = "";
for (var i = 0; i<ansi_string.length; i++) {
Code + = "%" +ansi_string.charcodeat (i)-toString (16);
}
var result = unescape (code);
System.usecodepage = temp;
return result;
}
Use examples:
My_sound = new sound ();
MY_SOUND.ONID3 = function () {
var songname = Ansi2utf (this.id3.songname);
Trace ("Result:" +songname);
};
My_sound.loadsound ("Music.mp3", false);
In addition, there is a phrase in Flash help:
Set the System.usecodepage property only once in the document, not to allow the player to interpret some external files as Unicode and to interpret other files as other encodings, and to use the property multiple times, because this can produce unpredictable results.
It seems that this function may bring hidden problems, as to what exactly is the problem, I have not yet encountered. There are other ways to solve mp3id3 garbled problems, such as establishing UTF-8 and GB2312/BIG5 encoded images, and so on, but none of this is simple.
The existing problems:
-can only convert local encoding to UTF-8, that is: Simplified system read Traditional Chinese ID3 will still have garbled, the same traditional system is also
-can only convert ID3 V2.0, can not turn ID3 V1.0
-can only convert ID3, for more extensive txt and other external text, the conversion method still has the problem
to the forum discussion