JSwiff
flash movies the java way
JSwiff Forum
  Search   Recent Topics     Member Listing    Back to home page 
Register / 
Login 
encoding error in Flash 5  
Forum Index -> Bugs
Author Message
Jim



Joined: Aug 15, 2005
Messages: 34
Location: China
Offline

FYI
use copySWF test function in Jswiff
arg0 is chinese.swf
arg1 is chinese_bak.swf

I found the text value is changed.

and it is in flash5, not in flash 6

chinese_bak.swf
 Description object swf Download
 Filesize 107 bytes
 Downloaded:  192 time(s)

chinese.swf
 Description source swf Download
 Filesize 103 bytes
 Downloaded:  197 time(s)

Ralf



Joined: Jul 20, 2005
Messages: 127
Location: Germany
Offline

First of all, sorry it took so long.
The problem was that regardless of the SWF version, JSwiff always decoded and encoded strings using unicode ("UTF-8"). In SWF 5 and earlier, this is incorrect, you have to use either ANSI ("cp1252") or Shift-JIS ("SJIS", i.e. Japanese encoding). I fixed this, 24 classes are affected...
However, the problem with SWF 5 and earlier is: you don't know when it's ANSI and when it's Shift-JIS. Spec says:

There is no way to indicate which encoding is used; instead, the decoding choice is made according to the locale in which Flash Player is running. This means that text content in SWF 5 or earlier can only be encoded in ANSI or shift-JIS, and the target audience must be known during authoring?otherwise garbled text will result. 


I think it would be pretty stupid to simulate this in Java by checking the locale. I solved this by adding a method setJapanese(boolean japanese) in SWFReader and SWFWriter, so you can decide whether strings are decoded/encoded using Shift-JIS or not (i.e. ANSI). The default is ANSI. Of course, for SWF version > 5, this is irrelevant, as UTF-8 is used for reading as well as writing SWFs.

Jim, I guess this Japanese talk is not too interesting for you, as you're Chinese. Please check if the text is the same in the SWF copy when using the nightly build. As far as I can tell, it is, but on my machine it's garbled both in the original and the copy. I attached a screenshot.

screenshot.png
 Description Screenshot Download
 Filesize 10 kb
 Downloaded:  178 time(s)

Jim



Joined: Aug 15, 2005
Messages: 34
Location: China
Offline

yes, it is ok now.
 
  Forum Index -> Bugs
Go to:   
Legal notes
Powered by JForum 2.1.4 © 2005 - Rafael Steil