On 10/02/2020 20:58, Christopher Schultz wrote:
> All,
> 
> I've recently begun making a change to my application's resource
> bundles, converting them into UTF-8 for readability and converting
> them to ISO-8859-1 during my build process to make ResourceBundle happy.
> 
> I have everything working, except that Eclipse still thinks that my
> files ought to be ISO-8859-1 and ruins them when I load them.
> Sometimes, it's very obvious and that's not a problem: a developer
> will see that and fix it before continuing. But some files are only
> *slightly* broken by this and someone might make a mistake.

I don't think we have seen this with Tomcat. Or have we (since we
switched to UTF-8)?

The thing that bugged me was having to manually switch properties files
to UTF-8 to view them "properly". You mail motivated me to track down
where I can change that in Eclipse:

Window->Preferences->General->Content Types

and I have changed Java properties files to use UTF-8. So that is my
personal niggle fixed. Thanks for the motivation.

> NOTE: We don't keep Eclipse settings in revision-control, so I can't
> modify everyone's Eclipse configuration. We are using svn and
> svn:mime-type is correctly set for these files; Eclipse just ignores tha
> t.

I've seen that too. While I found it rather annoying, it wasn't annoying
enough to try and find a fix as that looked like it would require
patching Eclipse and/or the svn plug-in.

> Anyway, I found that adding a UTF-8 BOM to the beginning of the file
> fixes that issue and Eclipse does the right thing.

Ah. So Eclipse *is* doing content scanning. Interesting.

> As a sanity check. I looked at how Tomcat's files are laid-out and I
> don't see any BOMs.

Correct. The only files in the code base that should have BOMs at the
moment are the ones in the test web application (under bug49nnn) for
testing the default Servlet's handling of files with BOMs.

> Should we add BOMs? Is there any reason NOT to use a BOM? These are
> file types that are officially supposed to be ISO-8859-1 but everyone
> wants to handle them differently, so I think adding BOMs might be a
> good idea so that editors are always informed of exactly what's happenin
> g.
> 
> WDYT?

I was concerned that adding a BOM would cause problems when reading
property files. I've seen reports of that with Java in the past. A quick
test suggests that the issue is no longer present with latest Java 8.

With the use of POEditor and the import/export scripts we have, it would
be unusual for someone to be editing any of the property files where
UTF-8 vs ISO-8859-1 matters. Thinking about it a little more, there
would be a need to do this to edit non-English strings in the older
branches where the key doesn't exist in the latest code. That strikes me
as a fairly rare use case.

My other worry is that some editors will fail to handle the BOM
correctly and we'll end up causing more issues than we solve. I've
little basis for that worry other than (possibly out of date) experience.

Overall, I guess I am -0 on adding BOMs.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to