9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Antons Suspans <antox@ml.lv>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] I don't understand utf8 (it seems)
Date: Tue,  6 Jan 2015 00:15:33 +0200	[thread overview]
Message-ID: <20150105221533.GA7830@ax.s16> (raw)
In-Reply-To: <5e85d81160785cdf717f01a8c0649731@quintile.net>

On Mon, Jan 05, 2015 at 09:52:12PM +0000, Steve Simon wrote:
> I am trying to parse a stream from a tcp connection.
> 
> I think the data is utf8, here is a sample
> 
> 	 20 2d 20 c8 65 73 6b fd 20 72 6f 7a 68 6c 61 73
> 
> which when I print it I get:
> 
>      -       e  s  k       r  o  z  h  l  a  s           
>            ^          ^
>         missing    missing
> 
> there are two missing characters. Ok, bad UTF8 perhaps?
> but when I try unicode(1) I see:
> 
> 	unicode c8 fd
> 	È
> 	ý
> 
> Is this 8 bit runes? (!)
> Is there a name for such a thing?
> Is this common?
> Is it just MS code pages but the >0x7f values happen (designed to) to map onto the same letters as utf8?
> 
> thanks in advance of useful suggestions ☺
> 
> -Steve
> 
> 

Those might be ISO-8859-1 octets.
The first 256 codepoints of Unicode are those of ISO-8859-1.

% unicode -t 20 2d 20 c8 65 73 6b fd 20 72 6f 7a 68 6c 61 73 | xd
- right away produces 18 octets representing 16 Unicode codepoints (listed as args).

% ascii -t 20 2d 20 c8 65 73 6b fd 20 72 6f 7a 68 6c 61 73 | tcs -f 8859-1 | xd
- yields 16 octets which are then treated as ones encoding 16 codepoints in ISO-8859-1
and transformed to 18 octets in UTF-8 (representing those same 16 codepoints).

Hope this helps,

-- 
Antons



  parent reply	other threads:[~2015-01-05 22:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 21:52 Steve Simon
2015-01-05 22:05 ` erik quanstrom
2015-01-05 22:27   ` Quintile
2015-01-05 22:15 ` Antons Suspans [this message]
2015-01-05 22:31 ` Bakul Shah
2015-01-06 19:57 ` Matěj Cepl
2015-01-06 22:09   ` Quintile
2015-01-07  9:43     ` a.f.e.belinfante

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150105221533.GA7830@ax.s16 \
    --to=antox@ml.lv \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).