Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Avernar
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
22 ms
·
151.
▲
by
Avernar
10y ago
I think he meant cell carrier, not ISP. But I disagree with him on this one. I'm glad Apple was able to get "special treatment" for many things from the carriers. They were more draconian than Apple with their rules. Now An
152.
▲
by
Avernar
10y ago
> no more pranking anyone by pushing all the buttons (because you can only do that while waiting for one and the system will dispatch the demanded floors to the pool) While it would stop pranking it opens it up to denial of service. Mos
153.
▲
by
Avernar
10y ago
> There's nothing to stop you contradicting yourself by indicating a different direction of travel. Which makes you wonder why you had to indicate the direction in the first place. You had to indicate the direction in the first plac
154.
▲
by
Avernar
10y ago
And there is still one tribe of people that are canibals. But that's just a cultural issue the rest of the world has with the tribe, but seriously, what's the issue other than they're people in almost the entire world and a
155.
▲
by
Avernar
10y ago
Bad example. If you want to embed that string in your code you have to type those 6 characters anyways. A better example is if you want to find a newline in a string. If you do a find it in a UTF-16 string it may be position 8 and a find
156.
▲
by
Avernar
10y ago
Why? Why should it be conceptually different if it's easy to work with the encoded form? Many unicode languages work with UTF-8 or UTF-16 internally. So working with the "transfer format" is common practice. While it may no
157.
▲
by
Avernar
10y ago
That's what they were hoping for. Didn't tuen out thst way. From icu-project.org: "As with glyphs, there is no one-to-one relationship between characters and code points. What an end-user thinks of as a single character (gr
158.
▲
by
Avernar
10y ago
> Clear win. I'd call it a slight improvement. And after the major step back of using 2 to 4 times more memory for strings I'd call it a net loss. > A code point string has other niceties, like being indexed by simple integ
159.
▲
by
Avernar
10y ago
> Plain text is friendly towards developers. But it’s neither interop-friendly nor user friendly. Kind of got off track here. You can process a lot of formats as text (html, css, xml, etc). So a BOM there is unnecessary and sometimes d
160.
▲
by
Avernar
10y ago
Looks like Javascript source code is required to be processed as UTF-16: ECMAScript source text is represented as a sequence of characters in the Unicode character encoding, version 3.0 or later. [...] ECMAScript source text is assumed to b
161.
▲
by
Avernar
10y ago
State machines would have to operate on the byte level. Otherwise each state would have to have have 65536 entries per state. The trick to handle UTF-8 would be to have 0-127 run as a state machine and > 127 break out to functions to h
162.
▲
by
Avernar
10y ago
Upvote for that comment. The stuff I've seen in some people's multithreaded code just makes me want to cry.
163.
▲
by
Avernar
10y ago
> I get your point, it just doesn't apply to many real world situations I've seen where you don't have the luxury of just using a higher level language or a library that takes care of all these things No, I still think you
164.
▲
by
Avernar
10y ago
Which is why we have languages like Go where we can put those types of developers. Incidentally Go use UTF-8. Higher level languages like Go, Python, etc were designed so newbie and/or ignorant programers could do less damage. When I
165.
▲
by
Avernar
10y ago
> Plain text isn’t exactly a machine-friendly format. Works fine for unix. :D > Could you please name a Microsoft program that you think requires a BOM? Visual C++ off the top of my head. It mangles UTF-8 string literals without the
166.
▲
by
Avernar
10y ago
> I’m a Windows developer. In my world, a program should generate its output in whatever format user wants it to be. When generating output for a user, letting them choose is a good idea. But for interop with other programs I leave it o
167.
▲
by
Avernar
10y ago
There's a difference between what a program should accept as input and what it should generate as output. The standard just says to expect a BOM on input and suggests not generating on output. In other words "A UTF-8 BOM is a bad
168.
▲
by
Avernar
10y ago
Why should it crash? The proper procedure when validating a UTF-8 string is to replace errors with U+FFFD. The term character has many meanings. Graphemes are characters and that's what most users expect, something that's displa
169.
▲
by
Avernar
10y ago
I consider changing a glyph to some other glyph(s) as corruption. Take an emoji flag character as an example. Split it between the code points and you end up with two boxed letters. If you chop in the middel of a code unit then you end up
170.
▲
by
Avernar
10y ago
This drives me crazy. The Win32 API was designed for UCS-2. Then UTF-16 came out and the API was shoehorned to use it but as you said they still haven't caught all the places where it still thinks it's UCS-2.
171.
▲
by
Avernar
10y ago
Not at all. The language/library impementor should handle the details. My example was the argument checking of the slice function. And indexing by code points doesn't solve the problem either. The majority of programmers don&#x
172.
▲
by
Avernar
10y ago
We're pretty much on the same page here. When you want to slice a string (because you can only display or store a certain amount) or you want to do text selection and other cursor operations you can't so it by code point. That&#
173.
▲
by
Avernar
10y ago
Oops, made a mistake. The bit pattern is 10 in the upper two bits if you're not at the first byte of a code point and not 11.
174.
▲
by
Avernar
10y ago
From section 2.6 in the standard: "Use of a BOM is neither required nor recommended for UTF-8, but may be encountered in contexts where UTF-8 data is converted from other encoding forms that use a BOM or where the BOM is used as a UTF-
175.
▲
by
Avernar
10y ago
Not impossible. If you slice in the middle of a grapheme then you get a corrupted string as well. You'll get an alternate glyph instead of a square box but it's still corrupted.
176.
▲
by
Avernar
10y ago
If by rune you mean code point that doesn't really gain you anything. If you are searching for something it's faster to just scan a byte at a time. If you want to split the string into "characters" you need to do it a t
177.
▲
by
Avernar
10y ago
It's very easy to not get corrupted strings when byte indexing into UTF-8. In a while loop, if the index is not at the end of the string and the top two bits of the character at the index are both one, advance the index by one. Or thr
178.
▲
by
Avernar
10y ago
The unicode BOM is code point U+FEFF. The process of encoding it determines the order. Encoded to UTF-8 it becomes EF BB BF. Encoding to UTF-16 big endian it will become FE FF. Encoding it to UTF-16 little endian it becomes FF FE. Conver
179.
▲
by
Avernar
10y ago
No. Python 2.7 uses UCS-2 or UCS-4 depending on how it was compiled. Python 3 uses ASCII, UCS-2 or UCS-4 determined at runtime per string depending on the string's contents.
180.
▲
by
Avernar
10y ago
> You might want to slice the quotes off of a quoted string That's why I really like dealing with UTF-8. As you said you can just index by byte instead of having to worry about code point boundries. This is because a code point wi
More ›