[JPP-Devel] Re How to edit properties files in GitHub right?

2021-11-09 Thread Rahkonen Jukka (MML)
Hi Ede,

I start to think that I am on a safe side with the Finnish language files.  All 
the special characters in the file are Unicode escaped like the translation 
"Päätä piirtäminen" in string
com.vividsolutions.jump.workbench.ui.cursortool.MultiClickTool.finish-drawing=P\u00e4\u00e4t\u00e4
 piirt\u00e4minen

If I understand right all the characters in the file are the just the same as 
ISO-8859-1 and UTF-8. And .properties files seem to be plain text files without 
any character set headers or magic strings so change into UTF-8 would not 
really change anything. 

It seems like the Finnish translation could be OK even without Unicode escapes 
because all the few special characters we have (åäöÅÄÖ) belong  to the 
ISO-8859-1 set https://www.w3schools.com/charsets/ref_html_8859.asp like "small 
a, umlaut mark" https://www.w3schools.com/charsets/tryit.asp?deci=228&ent=auml. 
But in that case change from 8859-1 into UTF-8 would break the translations.

I was reading that Java 9 supports UTF-8 properties so I made some tests with 
Unicode escapes, native 8859-1 characters, and UTF-8 characters.

Unicode escapes:
OK with Java 8
OK with Java 11

Native 8859-1:
OK with Java 8
Garbled with Java 11

UTF-8:
Garbled with Java 8
OK with Java 11

Thus I think that as long as we support Java 8 the properties files should use 
Unicode escapes everywhere.

-Jukka-


-Alkuperäinen viesti-
Lähettäjä: edgar.sol...@web.de  
Lähetetty: tiistai 9. marraskuuta 2021 20.16
Vastaanottaja: jump-pilot-devel@lists.sourceforge.net
Aihe: Re: [JPP-Devel] How to edit properties files in GitHub right?

On 09.11.2021 18:49, Rahkonen Jukka (MML) wrote:
> Hi,

hey Jukka,

> I was about to add some missing translations into Finnish language file in 
> GitHub but I noticed this warning:
>
> "We've detected the file encoding as ISO-8859-1. When you commit changes we 
> will transcode it to UTF-8."

neat of github webui to warn! i'm surprised, positively.

> However, with Java properties files I think that should not be done because 
> Java "properties files should be  encoded in ISO 8859-1 character encoding. 
> Characters that cannot be directly represented in this encoding can be 
> written using Unicode escapes" (from 
> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Properties.html).

correct

> What is the right method to edit the language files and not to mess the right 
> character encoding? Should I edit the whole file outside GitHub and replace 
> the whole jump_fi.properties file? And if so, how to replace files in GitHub?

as the github webui fails, the only proper way is to use a git client, clone 
the repo edit and push.

but actually the ISO9959-1 is a legacy and there are lot's of reasons to switch 
the repo over to UTF-8 (especially the ease of use to international 
contributers). maybe you wanna wait for that?

additionally, of course
1. you can download a snapshot containing a lang/ folder or download the file 
from github 2. do the edits 3. post it here and me or Mike will commit it then.

hope that helped.. healthy regards ede




___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Re How to edit properties files in GitHub right?

2021-11-09 Thread edgar . soldin

On 09.11.2021 21:57, Rahkonen Jukka (MML) wrote:

Hi Ede,

I start to think that I am on a safe side with the Finnish language files.  All the 
special characters in the file are Unicode escaped like the translation "Päätä 
piirtäminen" in string
com.vividsolutions.jump.workbench.ui.cursortool.MultiClickTool.finish-drawing=P\u00e4\u00e4t\u00e4
 piirt\u00e4minen

If I understand right all the characters in the file are the just the same as 
ISO-8859-1 and UTF-8. And .properties files seem to be plain text files without 
any character set headers or magic strings so change into UTF-8 would not 
really change anything.


right. as long as all non-ascii characters are escaped _and>_ you edit the 
files as UTF-8 _and_ only add ascii-characters again (escaping!) it should be fine.


It seems like the Finnish translation could be OK even without Unicode escapes because all 
the few special characters we have (åäöÅÄÖ) belong  to the ISO-8859-1 set 
https://www.w3schools.com/charsets/ref_html_8859.asp like "small a, umlaut mark" 
https://www.w3schools.com/charsets/tryit.asp?deci=228&ent=auml. But in that case change 
from 8859-1 into UTF-8 would break the translations.


yes, UTF-8 editing will garble those


I was reading that Java 9 supports UTF-8 properties so I made some tests with 
Unicode escapes, native 8859-1 characters, and UTF-8 characters.

Unicode escapes:
OK with Java 8
OK with Java 11

Native 8859-1:
OK with Java 8
Garbled with Java 11

UTF-8:
Garbled with Java 8
OK with Java 11

Thus I think that as long as we support Java 8 the properties files should use 
Unicode escapes everywhere.


not really.

i plan to convert the whole repo to UTF-8 (java,properties, every text really) 
and add a custom ResourceBundle.Control to I18N as described in 
https://stackoverflow.com/a/4660195/1308810, that'll make sure that the 
language files are loaded as UTF-8, even in java8.

..ede


___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Re How to edit properties files in GitHub right?

2021-11-09 Thread Rahkonen Jukka (MML)
edgar.sol...@web.de wrote: 

> i plan to convert the whole repo to UTF-8  (java,properties, every text 
> really) and  add a 
> custom ResourceBundle.Control to I18N as described in 
> https://stackoverflow.com/a/4660195/1308810, 
> that'll make sure that the language files are loaded as UTF-8, even in java8.

That would really make the life of the language file editors much easier. 
Hyv\u00e4 Ede!

-Jukka-

___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Re How to edit properties files in GitHub right?

2021-11-09 Thread edgar . soldin

On 09.11.2021 22:15, Rahkonen Jukka (MML) wrote:

edgar.sol...@web.de wrote:


i plan to convert the whole repo to UTF-8  (java,properties, every text really) 
and  add a
custom ResourceBundle.Control to I18N as described in 
https://stackoverflow.com/a/4660195/1308810,
that'll make sure that the language files are loaded as UTF-8, even in java8.


That would really make the life of the language file editors much easier. 
Hyv\u00e4 Ede!


yeah. not only that. having a western charset for the whole repo affects all 
text files and makes it difficult for other regions to edit as their editors 
are not set up to use it by default ;) ..working on it, ede


___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel