You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tuukka Ilomäki <tu...@teosto.fi> on 2020/05/19 12:31:46 UTC

Tomcat 8.5 appends null characters

Dear collective wisdom,
as the EOL of Tomcat 7 is looming, we are migrating our legacy app from Tomcat 7.0 to Tomcat 8.5. We deploy exactly the same war in both versions. For some reason Tomcat 8.5 adds null characters to the end of JavaScript files. For instance, jQuery file served by Tomcat 8.5 ends with “})( window ); �����” where five last characters are bytes 00. Tomcat 7.0 serves the same file correctly. In case it matters, the issue occurs in both windows 10 and windows server 2016 environments.

I assume this has something to do with character encoding. Original js-file is cp1252. I have perused Tomcat 8 migration guide and Tomcat encoding FAQ and experimented with the various options but so far with no luck. Any advice is greatly appreciated.

Tuukka


Re: Tomcat 8.5 appends null characters

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Martin,

On 5/19/20 09:50, Martin Grigorov wrote:
> Hi,
>
> On Tue, May 19, 2020 at 3:32 PM Tuukka Ilomäki
> <tu...@teosto.fi> wrote:
>
>> Dear collective wisdom, as the EOL of Tomcat 7 is looming, we are
>> migrating our legacy app from Tomcat 7.0 to Tomcat 8.5. We deploy
>> exactly the same war in both versions. For some reason Tomcat 8.5
>> adds null characters to the end of JavaScript files. For
>> instance, jQuery file served by Tomcat 8.5 ends with “})( window
>> ); �����” where five last characters are bytes 00. Tomcat 7.0
>> serves the same file correctly. In case it matters, the issue
>> occurs in both windows 10 and windows server 2016 environments.
>>
>> I assume this has something to do with character encoding.
>> Original js-file is cp1252. I have perused Tomcat 8 migration
>> guide and Tomcat encoding FAQ and experimented with the various
>> options but so far with no luck. Any advice is greatly
>> appreciated.
>>
>
> I'd advise you to convert your files to UTF-8. Or tell Tomcat to
> write responses in your preferred encoding.

Tailing nulls might also be a misinterpreted chunked response. (I'm
grasping at straws, here).

Tuukka, is your client communicating directly with Tomcat, or through
some kind of proxy or load balancer?

I've been using the same product with Tomcat since the 4.1 series, and
I upgraded through every single major version from there to 9.0. I've
never seen anything like that.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl7ESsgACgkQHPApP6U8
pFgreA//VI1lMAk/P9hnlx1WCU9Uz2Ccb/UYDZe3HVTO4FrjqUkPi3eOC5Zf5nu9
r0AfFRZVpdiih9z4DGPngarxsymqxi8VfIds2HJcGtbYtJ4Kxt1WBUBCB//EmzSr
YU70a6LL3IzbWecV641497JvfASFTCc7LUTbO6D48RFezoPPD+g3tAhPLsUNtOr9
hBD8nINL+g4HTUb5uA0+N60Sjp81BXLlYbnX5FGzAwxicZtgLkGir/au0yqWEOTC
kZ+ejPUKpYw4ingWrlv4iY6+3EPLsi2jiTu+nLkiHKmcVvcxVkWt3m+KpvVWef14
78WFHPMBeBhgt4vpX37+YSkeVUVqr+NyX2Fyp/6mW8cyXFgYIi7C4YAyLpF7zeNz
3xRll64nvGnKghD/jbiHUr1prqwECXUFNKfPBK2XBL7k1h1I7eRzUtkUIbmwWQ6T
LwmwY3LXQ1+TLoISppQ5Cb27z3SfPVqi/2dFXbdqiLF2VOpCNKJl1qSDtlVEN5Az
qMKInNfegUoHAvznFclJX/3pFEhdA1l+LWbpd1zVbOMfm9ZCAi0dUtW75NTuP/Ur
43NGSXbxiblrq0xhxY+qVbEs9lnz9vhK9wRApSdBfN7/errej1IAXhKk9lFgJx4K
O5I3nIfT2BtHIKj5eDDTlYJfTlvRkkzAV4MPGPmBjVHdvAWmfsw=
=JiQr
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8.5 appends null characters

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Tue, May 19, 2020 at 3:32 PM Tuukka Ilomäki <tu...@teosto.fi>
wrote:

> Dear collective wisdom,
> as the EOL of Tomcat 7 is looming, we are migrating our legacy app from
> Tomcat 7.0 to Tomcat 8.5. We deploy exactly the same war in both versions.
> For some reason Tomcat 8.5 adds null characters to the end of JavaScript
> files. For instance, jQuery file served by Tomcat 8.5 ends with “})( window
> ); �����” where five last characters are bytes 00. Tomcat 7.0 serves the
> same file correctly. In case it matters, the issue occurs in both windows
> 10 and windows server 2016 environments.
>
> I assume this has something to do with character encoding. Original
> js-file is cp1252. I have perused Tomcat 8 migration guide and Tomcat
> encoding FAQ and experimented with the various options but so far with no
> luck. Any advice is greatly appreciated.
>

I'd advise you to convert your files to UTF-8.
Or tell Tomcat to write responses in your preferred encoding.


>
> Tuukka
>
>