Re: Tomcat9, JSP, CSS and JS not loading in Firefox
On 22.01.2020 10:26, Lmhelp1 wrote: Hello Chris and all, Sorry for my late answer. Thank you for the link you suggested me to read. Adding the element: UTF-8 to "web.xml" solved my problem. Glad to hear that. From an absolute point of view, this is of course again a "patch". But as Chris pointed out before, it is unfortunately an unavoidable one, due to the fact that the browsers lamentably fail to always indicate the character set and encoding that they are using for sending text data to the server. [RANT:] (Although they know, and although the specifications provide them with an easy way to do that. Why that is so is anyone's guess, but the economic losses due to that over the years must be staggering). (probably close to the cost of allowing spaces in directories and files names) On 17/01/2020 3:17 PM, Christopher Schultz wrote: Your filter changes the encoding of both the request AND the response. It's likely that fixing the request-encoding was necessary, while changing the response-encoding was not. The problem is: 1. The official RFC-defined default character encoding for HTTP is ISO-8859-1. 2. The browser default appears to be unpredictable, but often UTF-8. 3. The browsers have all agreed not to tell the server what characted encoding is actually being used. It's fun. It's a very simply-solved problem: the browser should just advertise the character encoding and everything would be great. Sadly, n o. I would encourage you to read this page in its entirety: https://cwiki.apache.org/confluence/display/TOMCAT/Character+Encoding - -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat9, JSP, CSS and JS not loading in Firefox
Hello Chris and all, Sorry for my late answer. Thank you for the link you suggested me to read. Adding the element: UTF-8 to "web.xml" solved my problem. Best regards, -- Léa On 17/01/2020 3:17 PM, Christopher Schultz wrote: Your filter changes the encoding of both the request AND the response. It's likely that fixing the request-encoding was necessary, while changing the response-encoding was not. The problem is: 1. The official RFC-defined default character encoding for HTTP is ISO-8859-1. 2. The browser default appears to be unpredictable, but often UTF-8. 3. The browsers have all agreed not to tell the server what characted encoding is actually being used. It's fun. It's a very simply-solved problem: the browser should just advertise the character encoding and everything would be great. Sadly, n o. I would encourage you to read this page in its entirety: https://cwiki.apache.org/confluence/display/TOMCAT/Character+Encoding - -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat9, JSP, CSS and JS not loading in Firefox
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Léa, On 1/17/20 8:48 AM, Lmhelp1 wrote: > Hello, > > Thank you for your answer. > > So, I removed the filter from "web.xml". > > Now, some characters with diacritics are rendered properly (for > example constant strings like menu entries: "Présentation"). > > But I created a new user "Léa": I entered "Léa" in a input type > text HTML element and submitted the form in which was the input > element. Now "Léa" is rendered as "Léa" when I need to dipslay it > either back in an input or as text in a "div". > > The filter that I put in 2015 in the Webapp (I don't really > remember how, I guess I had the same problem at the time) prevented > such things from happening. Your filter changes the encoding of both the request AND the response. It's likely that fixing the request-encoding was necessary, while changing the response-encoding was not. The problem is: 1. The official RFC-defined default character encoding for HTTP is ISO-8859-1. 2. The browser default appears to be unpredictable, but often UTF-8. 3. The browsers have all agreed not to tell the server what characted encoding is actually being used. It's fun. It's a very simply-solved problem: the browser should just advertise the character encoding and everything would be great. Sadly, n o. I would encourage you to read this page in its entirety: https://cwiki.apache.org/confluence/display/TOMCAT/Character+Encoding - -chris -BEGIN PGP SIGNATURE- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl4hwhQACgkQHPApP6U8 pFixlRAAxZzJiGd/uqbehT1qF7BF2Bff7KfiAxqmCzohjwEv2S6mSDw9t7EiV744 oNlPTiXeok6Rt+gH5TNpSAtFXFPSpr2IKP42FjwmXjJabdHfByZrUor65TIfZCfS DbzHVsRm4YPBobeEtwNVtIhYbcdEt0/qP4QticyNo/mXh1aHA1q0HPvcvNrJeYgn RAgrhUUxZnU+TQvB6GbX06/70LRz42H4jsxxI+MA7cmy/i1JejJ4RQad6LE85fuO kmeZea0XohrjnJevE2vjpuTmI02+j7IJKWgaIWfKUWgys64VG4L1O6u6RG4Wzku5 V9yi7kHI46PFUVAABykmsybZV1kH7nqQoAX/h8RxhZToFCowtahYDstyoNe2Zy8S Q80RtgyLwo8OviQIat0F9SeZG47EZ7KRzlvYLUNad/eGpW5jKXyktyXB4nk9qXdY Uk2xWiYxa4krCh+Ug7YMBooYvmHAL9Ch6AuLQDezzngTGC1Gt8IPxYZ/Jltducce 6IvVWDIDsu3D6AXCedmg2CldgdxYMA1Q2EoYWym/bPkE8Fynltuo5nE+BOPHU+k+ /zapbocbRJ7xFAVuJ6XNQUfC4vYHofg68s8W6LOfpQqFM/bjvyOp2vWX1MQ0zKzh SSaBl7NnysRCAHsgJcvqpIRwGZKvBHBiqU10d0ZaPLzU8m31DMY= =Uf+6 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat9, JSP, CSS and JS not loading in Firefox
Hello, Thank you for your answer. So, I removed the filter from "web.xml". Now, some characters with diacritics are rendered properly (for example constant strings like menu entries: "Présentation"). But I created a new user "Léa": I entered "Léa" in a input type text HTML element and submitted the form in which was the input element. Now "Léa" is rendered as "Léa" when I need to dipslay it either back in an input or as text in a "div". The filter that I put in 2015 in the Webapp (I don't really remember how, I guess I had the same problem at the time) prevented such things from happening. Please help. Thanks, -- Léa On 17/01/2020 9:36 AM, André Warnier (tomcat/perl) wrote: I believe Chris had a bit too much - or too little - coffee when he wrote the above, and that he meant : 1. Delete the *filter*and remove all references to it in web.xml 2. ... The point is : if your application is well-written and follows the standards, you should not normally need this Encoding filter, and everything should "just work". This filter is probably a left-over "patch" from either an older (and incorrect) application version, or some older version of Tomcat. That is why I first recommended that you remove the whole filter section from your web.xml, and check what happens. Display some pages which /should/contain some text in non-English languages (meaning with "diacritics" like è, é, à, ü, ö, ..) and if they display correctly, there is nothing else to do. Only if you /do/get a wrong display of some of that data, then you should come back here, and try to describe what is wrong. And we could then help you find the root cause. That would be better than trying to apply a patch over a patch over a patch..
Re: Tomcat9, JSP, CSS and JS not loading in Firefox
On 17.01.2020 04:15, Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Léa, On 1/16/20 9:33 AM, Lmhelp1 wrote: Hello, Thank you for your answers. I changed /* to *.jsp I also un-commented the line: servletResponse.setContentType("text/html; charset=" + Finals.S_CHARSET); It looks like the problem is solved. [snip] Shall I leave *.jsp as it is, or can you suggest another pattern? There is a better solution: 1. Delete the files and removed references to it in web.xml 2. Edit your JSP files and properly set the content-type and encoding in the @page directive at the top of the file. I believe Chris had a bit too much - or too little - coffee when he wrote the above, and that he meant : 1. Delete the *filter* and remove all references to it in web.xml 2. ... The point is : if your application is well-written and follows the standards, you should not normally need this Encoding filter, and everything should "just work". This filter is probably a left-over "patch" from either an older (and incorrect) application version, or some older version of Tomcat. That is why I first recommended that you remove the whole filter section from your web.xml, and check what happens. Display some pages which /should/ contain some text in non-English languages (meaning with "diacritics" like è, é, à, ü, ö, ..) and if they display correctly, there is nothing else to do. Only if you /do/ get a wrong display of some of that data, then you should come back here, and try to describe what is wrong. And we could then help you find the root cause. That would be better than trying to apply a patch over a patch over a patch.. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat9, JSP, CSS and JS not loading in Firefox
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Léa, On 1/16/20 9:33 AM, Lmhelp1 wrote: > Hello, > > Thank you for your answers. > > I changed /* to > *.jsp I also un-commented the line: > servletResponse.setContentType("text/html; charset=" + > Finals.S_CHARSET); > > It looks like the problem is solved. > > [snip] > > Shall I leave *.jsp as it is, or can > you suggest another pattern? There is a better solution: 1. Delete the files and removed references to it in web.xml 2. Edit your JSP files and properly set the content-type and encoding in the @page directive at the top of the file. - -chris -BEGIN PGP SIGNATURE- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl4hJroACgkQHPApP6U8 pFhnMRAAkQSTBhK6okaq3iyZFnTY1n7cGM6iOxO3llWU1CTFgoae9Z4U/d0tXCEc jpMj+ymmGSfgJxyidNJAQSrVU8bFulTKwPvPeaXylLJ5twO/NigzSfYAoTredBpC zywp6ddQLYaK2r+/PAixIV+afDIEh2VEmrZo/vNUfgxo/8rZWrcGp8f5xSxXebXS 0Cww/6oFR0z1J9nnv9DRyxj5uKOUqOKfCoh2hyuJcoKWHMG/2knLVx5WcZSd+NJe cRWVNxdmriL7FT+4ywK39Y03FRegvAusFTnwDmjyImmFPKinssGFBSKuOrWkH6XN yDehvqU5HnURqGBOUm2ABl2EJQmpu+s217DdEy8WZcGHsWLFZYl9SuL5wtxRAj/L K62tGeIgykPV2NMTM+PMi6AymzMhNQllsLFl29bYZPm3tmnwvbDoTGIXNyGs8StU pTloCtQj354aEv/1fuaNb0WzjsVd+WYRAsf2Wy4rh4mV1HFhGGJvXADmzFgNgFQI bSNWCQTUWUOtKElbfzcTY/BqOHnmIRFZJe5zdRjL7fcug4ograyYLylFvSt/HJoB K3sH1RZKLFywrGk1VszRuvgVVQF72MfpHkCrq1bbZxtkR9d5WzI9CFUXI8aXKV2b OgY1SefZb6pYSQcxbWQFdRzoxkkKH8wnfPkEY4A2MUqR7DTw4WY= =3osL -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat9, JSP, CSS and JS not loading in Firefox
Hello, Thank you for your answers. I changed /* to *.jsp I also un-commented the line: servletResponse.setContentType("text/html; charset=" + Finals.S_CHARSET); It looks like the problem is solved. > André Warnier wrote: > As another way of avoiding that problem, you may also want to change in web.xml : > /* > by something that applies *only*to HTML responses. Shall I leave *.jsp as it is, or can you suggest another pattern? Thank you and best regards, -- Léa On 16/01/2020 11:24 AM, André Warnier (tomcat/perl) wrote: Also note : https://tomcat.apache.org/tomcat-9.0-doc/servletapi/javax/servlet/ServletResponse.html#setCharacterEncoding-java.lang.String- says : "...calling this method with the String of UTF-8 is equivalent with calling setContentType with the String of text/html; charset=UTF-8." So, in the above, if you have just commented-out the line : servletResponse.setContentType("text/html; charset=" + Finals.S_CHARSET); but you left the following line unchanged servletResponse.setCharacterEncoding(Finals.S_CHARSET); then executing this line is equivalent to setting the content type to "text/html". And this looks suspiciously like the error you are getting.. As another way of avoiding that problem, you may also want to change in web.xml : > /* by something that applies *only*to HTML responses.