TB> That's not that uncommon, but the right solution is to *detect* that
the output is UTF-8 when the IDE runs whatever it is you're running.

That's hard to do in general, unfortunately. Web browsers do character set
detection by a statistical analysis of character frequencies in input
documents [1]--and it's not at all guaranteed to be correct (and magic BOM
characters are far from universal). Console output likely has a different
statistical profile of characters than that of web pages (making existing
libraries less accurate), and furthermore, console output is not available
"all at once" for analysis. After how many lines of output should the
console detect the encoding? Should it then switch from one encoding to
another? Should it switch again if more lines are printed and the analysis
can be made more accurate?

VWSdS> Netbeans should ... at least provide an easy and accessible way to
[l]et the user define it.
That will be more reliable. Options could be made available from the
right-click menu in the terminal. There could also be an option here that
tries to auto-detect the encoding only at the time that the "Auto-Detect"
option is invoked, based on whatever data is currently in the terminal.
That alleviates some of the previously mentioned issues.


Though this still sounds like a problem with the app--console text output
should generally be in whatever encoding the OS expects on its own
terminal/command-line tool. Otherwise the output would be equally garbled
in the OS terminal.

-- Eirik

[1] https://www-archive.mozilla.org/projects/intl/chardet.html



On 4/20/18, 8:33 PM, "Victor Williams Stafusa da Silva"
<victorwssi...@gmail.com> wrote:

>In my case, I'm running in windows, with the dreaded and hated
>Windows-1252
>default encoding.
>
>Using default OS encoding is really bad for portability and causes a lot
>of
>encoding problems. See this JEP draft maybe for Java 11:
>http://openjdk.java.net/jeps/8187041 - There are three proposed
>alternatives: 1) Keep the status quo; 2) Deprecate all the methods that
>uses the platform default encoding; 3) Force UTF-8 deing the default
>regardless of anything.
>
>As a speaker of Portuguese, a language that is full of diacritics, I'm
>already very sick of years and years of being haunted by encoding problems
>in buggy software. But it could be much worse if my language was Chinese
>or
>Japanese.
>
>Since option 1 is unacceptable and 3 is too drastic and dangerous due to
>backwards-compatibility concerns, I think that this JEP, if it eventually
>gets delivered, will go to option 2.
>
>Anyway, regardless of this JEP or its future, Netbeans should either get
>the correct encoding in the console window or at least provide an easy and
>accessible way to et the user define it.
>
>Victor Williams Stafusa da Silva
>
>
>2018-04-20 20:00 GMT-03:00 Tim Boudreau <niftin...@gmail.com>:
>
>> Your problem is most likely your operating system's default file
>>encoding
>> here (perhaps MacRoman?).  The IDE is assuming that process output is
>> whatever your operating system's default encoding is, which is the right
>> assumption, since that *is* what command-line utilities will output.  It
>> happens that the process you're running is outputting UTF-8 *rather
>>than*
>> the
>> OS's default encoding.
>>
>> Setting that as a default would be assuming that every operating system
>> uses UTF-8 regardless of what it does - it would be wrong a lot of the
>> time.  It just happens to solve the case that whatever you're running is
>> outputting UTF-8 in spite of what the operating system provides.
>>
>> That's not that uncommon, but the right solution is to *detect* that the
>> output is UTF-8 when the IDE runs whatever it is you're running.
>>
>> So... what are you running?  Is this project output?  If so, what kind
>>of
>> project?  Or server output of some kind?  A correct fix would be to (if
>> possible), detect what that is and that it will output UTF-8, and have
>>the
>> IDE open the output of that process with the right encoding.
>>
>> -Tim
>>
>> On Fri, Apr 20, 2018 at 6:18 PM, Victor Williams Stafusa da Silva <
>> victorwssi...@gmail.com> wrote:
>>
>> > I frequently had some long-standing problems with the console output
>> > encoding in Netbeans. Which always presented garbled non-ascii
>>characters
>> > for me.
>> >
>> > After deciding that it was enough, I went to search for a solution and
>> did
>> > found a very simple one in StackOverflow. Just add
>> -J-Dfile.encoding=UTF-8
>> > into the netbeans_default_options line of netbeans.conf file and
>>voilĂ ,
>> it
>> > works!
>> >
>> > However, this make me think about it:
>> >
>> > 1. Is there a reason to not add it there by default?
>> >
>> > 2. If it can't be added there by default for some reason, can it at
>>least
>> > be something more user-friendly and less arcane to be configured by
>>the
>> > normal user?
>> >
>> > Victor Williams Stafusa da Silva
>> >
>>
>>
>>
>> --
>> http://timboudreau.com
>>


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

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to