26

Re: New TinyMCE GZip compressors released

Purepear,
This did the trick:-)
You're the greatest!

27

Re: New TinyMCE GZip compressors released

The new compressors are much better, thanks for that.  I've written one for Ruby on Rails based on the new compressor code.

http://garbageburrito.com/blog/entry/89

Please test it out and give me some feedback.

28

Re: New TinyMCE GZip compressors released

Well, there is indeed a bug in the JavaScript file (or in the calls) for Internet Explorer v 6.0 SP1 or less.

The JS file has a function called tinyMCE_GZ.checkCompress() which returns 0 (false) if the person is using IE 6.0 SP1 or less.  (IE 6.0 SP2 or IE7 return 1, as well as all non-IE browsers.)

If checkCompress() is 0, then '&compress=false' is added to the end of the tiny_mce_gzip.aspx (or .php) QueryString, which in turn deactivates gzip compression for the file that gets loaded.

Now, with compressioned turned off, I believe the problem is that all the normal function calls are made, as if the file is compressed, so when a bad function call is made, the JavaScript stops executing, so TinyMCE does not get instantiated.

Here's the weird part (and why I didn't spend much more time trying to figure out the root cause): the very first time IE 6.0 SP1 or less is run, the editor loads, but each time after that it fails.  (Just refresh the page to see.)

To immediately get around the error, comment out the following line in tiny_mce_gzip.js:

v += this.checkCompress() ? '' : '&compress=false';

becomes:

//v += this.checkCompress() ? '' : '&compress=false';

After the line is commented out, the problem does not seem to happen in IE6 anymore.

Of course, this is just a band-aid, and does not address whatever the root cause is.

29

Re: New TinyMCE GZip compressors released

Language problem? (PHP compressor 1.0.9)

When I enter in the tinyMCE_GZ.init function more than one language, the editor is using the last language as default even if I specify another language in tinyMCE.init

Example:

tinyMCE_GZ.init({...,languages:'en,nl',...});

tinyMCE.init({...,language:"en",...})

Then the editor displays Dutch (nl) tooltips. Anybody the same problem?

Last edited by Henkie (2006-10-28 16:44:01)

30

Re: New TinyMCE GZip compressors released

TinyMCE doesn't support multiple languages on the same page. This is most likely to change sometime in the future so the gzip compressor has support for it so that it will function ones TinyMCE has that support.

Best regards,
Spocke - Main developer of TinyMCE

31

Re: New TinyMCE GZip compressors released

I made a new workaround for the gzip compression bug in IE. It now uses synchronous AJAX to load the JavaScript this will hopefully make a new instance of the "browser" so that this bug doesn't occur. I made some initial testing in our testing environment and it seems to work now but I need volunteers to verify that this is working since I don't have all versions of IE available here.

The latest version can be found in the SVN, I have only updated the PHP version of the script.

http://tinymce.svn.sourceforge.net/view … php/trunk/

Best regards,
Spocke - Main developer of TinyMCE

32

Re: New TinyMCE GZip compressors released

If you are still having problems getting TinyMCE to work (tinyMCE is not defined error) - although you have put tinyMCE_GZ.init({ and tinyMCE.init({ into two seperate JavaScript tags - and you are using a foreign language, you might want to take a look here:

http://tinymce.moxiecode.com/punbb/view … 946#p16946

Regards
Leo

33

Re: New TinyMCE GZip compressors released

I’m using the new gzip compressors under ColdFusion 7 and IE 6 and I had the following problem:
Some users had their IE browsers with the “Use HTTP 1.1” and/or “Use HTTP 1.1 through proxy connections” advanced options unchecked causing that the Accept-Encoding request header was not being send to the server, this crashed the tinymce_gzipcompressor.jar code and by consequence the tinyEditor was not being initialized.

The fix:
Go to GZipCompressor.java and change the code from these:

// Check if it supports gzip
enc = request.getHeader("Accept-Encoding").replaceAll("\\s+", "").toLowerCase();
supportsGzip = enc.indexOf("gzip") != -1 || request.getHeader("---------------") != null;
enc = enc.indexOf("x-gzip") != -1 ? "x-gzip" : "gzip";

To:

// Check if it supports gzip
enc = request.getHeader("Accept-Encoding");
if (enc != null) {
   enc = enc.replaceAll("\\s+", "").toLowerCase();
   supportsGzip = enc.indexOf("gzip") != -1 || request.getHeader("---------------") != null;
   enc = enc.indexOf("x-gzip") != -1 ? "x-gzip" : "gzip";
} else {
   supportsGzip = false;
}

Compile with the make.bat provided and replace the tinymce_gzipcompressor.jar with the new one. (you might have to stop the ColdFusion services to replace the jar file)

I hope it helps.
Z.

34

Re: New TinyMCE GZip compressors released

Interesting thanks a lot for this one. I will include it in the next release of the gzip compressor.

Best regards,
Spocke - Main developer of TinyMCE

35

Re: New TinyMCE GZip compressors released

Oh! Please add this tips to readme.html:

...the two .init() functions must be in different <script></script> tags.

tiny_mce_gzip.js folder must have write permission

36

Re: New TinyMCE GZip compressors released

For the following code in the tiny_mce_gzip.js file:

        for (i=0, nl = d.getElementsByTagName('script'); i<nl.length; i++) {
            if (nl[i].src && nl[i].src.indexOf('tiny_mce_gzip') != -1) {
                sr = nl[i].src;
                sr = sr.substring(0, sr.lastIndexOf('/'));

                if (b != '' && b.indexOf('://') == -1)
                    b += sr;
                else
                    b = sr;
            }
        }

Shouldn't you cosider aborting the for/next when you find a matching SCRIPT so as to avoid over concatenating the b variable?

Last edited by jeffmowens (2006-12-05 22:15:53)

37

Re: New TinyMCE GZip compressors released

You saved me from lot of grief, Thanks!

lionfish wrote:

For those of you who have the "Wrong datatype for second argument" error in tiny_mce_gzip.php (line 66).
I've got a work around of this bug by patching this lines of code:

Old code:

if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) { 
$enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip"; 
$supportsGzip = true; 
}

New code:

// if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
  $enc = "gzip";
  $supportsGzip = true;
// }

smile As you can see, all I've done - is commenting out the 'if' statement and then telling the script the exact 'gzip' encoding type. This looks like forcing gzip, even if webserver doesn't seem to support it, although it does actually.
It worked for me, so why wouldn't it work for you then ;-)

38

Re: New TinyMCE GZip compressors released

(Copied this from another thread)

It is not a good idea to comment out that part.

    // Check if it supports gzip
    if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
        $encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));

    if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
        $enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
        $supportsGzip = true;
    }

Add this before those lines

$encodings = array();

What kind of server are you running by the way? It seems like your server doesn't have this server variables set at all
$_SERVER['HTTP_ACCEPT_ENCODING']

Upload a php file with phpinfo(); in it, and check what the HTTP_ACCEPT_ENCODING string says (if it exists). Write it here plz.

Afraithe
TinyMCE Developer
Moxiecode Systems

39

Re: New TinyMCE GZip compressors released

Altho... commenting out that part enables gzip even if your server says he can't handle it.

Afraithe
TinyMCE Developer
Moxiecode Systems

40

Re: New TinyMCE GZip compressors released

So the new compressor works around the IE bug by basically not using compression if the browser is IE, correct?

41

Re: New TinyMCE GZip compressors released

The current one does it in that way. But the SVN version has a different approach that seems to be working fine. What it all comes down to is that various old IE versions or new IE versions with some MS patches break since the HTTP content gets chunked incorrectly in other words it removes pieces of the content here and there inside the script. The new SVN workaround uses AJAX to load the script in IE. This avoids this issue since the AJAX request seems to be done in a separate HTTP connection.

We are planing to release updates for this issue soon this week or beginning of January.

Best regards,
Spocke - Main developer of TinyMCE