Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38262 > unrolled thread
| Started by | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| First post | 2018-05-22 10:59 -0700 |
| Last post | 2018-05-23 22:35 +0200 |
| Articles | 4 on this page of 24 — 6 participants |
Back to article view | Back to comp.lang.java.programmer
how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 10:59 -0700
Re: how do you block the GUI repaints? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2018-05-22 13:22 -0500
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:00 -0700
Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 16:29 -0400
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:51 -0700
Re: how do you block the GUI repaints? Martin Gregorie <martin@mydomain.invalid> - 2018-05-22 21:41 +0000
Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 18:03 -0400
Re: how do you block the GUI repaints? Andreas Leitgeb <avl@logic.at> - 2018-05-22 22:22 +0000
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:55 -0700
Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-23 11:06 -0400
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 08:19 -0700
Re: how do you block the GUI repaints? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-22 14:43 -0400
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:20 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-22 22:47 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-22 13:58 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 04:30 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 05:54 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 15:58 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:26 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 16:30 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 07:48 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 18:46 +0200
Re: how do you block the GUI repaints? Eric Douglas <e.d.programmer@gmail.com> - 2018-05-23 10:51 -0700
Re: how do you block the GUI repaints? Daniele Futtorovic <da.futt.news@laposte.net> - 2018-05-23 22:35 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-05-23 07:48 -0700 |
| Message-ID | <dc7c06c5-d19f-406d-9ef2-39afd210c18a@googlegroups.com> |
| In reply to | #38279 |
On Wednesday, May 23, 2018 at 10:31:07 AM UTC-4, Daniele Futtorovic wrote: > > > > The "squares" appear because the font you're using does not have any > glyph for the codepoints that you're trying to show. > > As for the rest... Good Luck! > > -- > DF. I tried setting the JTextArea font to Lucida Sans Unicode. If that doesn't have a glyph for the characters I don't know what would. NotePad++ does identify these characters as something, even if I'm not sure what all their codes mean. As I'm just reading files in as byte[] array I was wondering if I need to do some kind of character encoding conversion to create a displayable String, or if I just need to call a method to test for characters that won't display and convert to a hex view.
[toc] | [prev] | [next] | [standalone]
| From | Daniele Futtorovic <da.futt.news@laposte.net> |
|---|---|
| Date | 2018-05-23 18:46 +0200 |
| Message-ID | <pe45ua$600$1@dont-email.me> |
| In reply to | #38280 |
On 2018-05-23 16:48, Eric Douglas wrote: > On Wednesday, May 23, 2018 at 10:31:07 AM UTC-4, Daniele Futtorovic wrote: >>> >> >> The "squares" appear because the font you're using does not have any >> glyph for the codepoints that you're trying to show. >> >> As for the rest... Good Luck! > > I tried setting the JTextArea font to Lucida Sans Unicode. If that doesn't have a glyph for the characters I don't know what would. None will. Because those aren't characters (or more precisely, the byte-encoded representation of characters). > As I'm just reading files in as byte[] array I was wondering if I need to do some kind of character encoding conversion to create a displayable String, or if I just need to call a method to test for characters that won't display and convert to a hex view. You'll have to know beforehand what encoding your text file is in. There is, to my knowledge, no general-purpose, reliable way of determining the encoding of an arbitrary file (including whether it's text or not). Elsethreads, you talk about "JTextArea's character encoding". JTextArea does not have a character encoding. Once a String is in the Java runtime, it's a String, period. No character encoding. Character encoding has to happen at the boundary of the Java runtime, so to speak, when you are reading external data in (in this case, your file). I would suggest using java.nio.charset.CharsetDecoder-s in combination with the java.nio.channels.FileChannel instance you can obtain from the RandomAccessFile instance (because both work with java.nio.ByteBuffer-s). If you're unfamiliar with character (en|de)coding or Java NIO buffers, I would strongly suggest you look up a tutorial on those. -- DF.
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2018-05-23 10:51 -0700 |
| Message-ID | <29c0196d-8d2e-489c-ab8a-e99fab3012ad@googlegroups.com> |
| In reply to | #38287 |
On Wednesday, May 23, 2018 at 12:47:17 PM UTC-4, Daniele Futtorovic wrote:
> You'll have to know beforehand what encoding your text file is in. There
> is, to my knowledge, no general-purpose, reliable way of determining the
> encoding of an arbitrary file (including whether it's text or not).
>
> Elsethreads, you talk about "JTextArea's character encoding". JTextArea
> does not have a character encoding. Once a String is in the Java
> runtime, it's a String, period. No character encoding. Character
> encoding has to happen at the boundary of the Java runtime, so to speak,
> when you are reading external data in (in this case, your file).
>
> I would suggest using java.nio.charset.CharsetDecoder-s in combination
> with the java.nio.channels.FileChannel instance you can obtain from the
> RandomAccessFile instance (because both work with
> java.nio.ByteBuffer-s). If you're unfamiliar with character
> (en|de)coding or Java NIO buffers, I would strongly suggest you look up
> a tutorial on those.
>
> --
> DF.
Yes, I am or was confused. I'm thinking a String is just a collection of characters which are just collections of bytes, and once the String is created it should hold anything a byte array can hold and the control needs to know how to display it. Apparently it's the font that needs to know how to display it. So, I don't know how Notepad++ comes up with their codes to show what non-displayable characters look like, but if the Font has a method to say the character can't be displayed I'll just go with displaying a placeholder, most likely a dot (".") and show the value of the position in hex. I have code here somewhere to convert bytes to hex.
[toc] | [prev] | [next] | [standalone]
| From | Daniele Futtorovic <da.futt.news@laposte.net> |
|---|---|
| Date | 2018-05-23 22:35 +0200 |
| Message-ID | <pe4jbf$u1c$1@dont-email.me> |
| In reply to | #38288 |
On 2018-05-23 19:51, Eric Douglas wrote:
> Yes, I am or was confused. I'm thinking a String is just a collection of characters
Correct.
> which are just collections of bytes,
Incorrect. They are an /interpretation/ of bytes. The same bytes can
mean different characters depending on the encoding.
> and once the String is created it should hold anything a byte array can hold
Technically, it can. It's just that what you /think/ it is holding might
differ from what it (the String) thinks it's holding... again, because
encoding is an interpretation of data.
> and the control needs to know how to display it.> Apparently it's the font that needs to know how to display it.
Incorrect. If it isn't a character - i.e. if there isn't a character
corresponding to the underlying byte sequence in the given
interpretation (encoding) - then it's not the font's responsibility to
display it.
> So, I don't know how Notepad++ comes up with their codes to show what non-displayable characters look like,
A mix of making stuff up and the control sequences from the old ASCII
days, I'd reckon.
> but if the Font has a method to say the character can't be displayed I'll just go with displaying a placeholder, most likely a dot (".")
Or a square, perhaps?
--
DF.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.java.programmer
csiph-web