Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ChrisSD
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
25 ms
·
241.
▲
by
ChrisSD
6y ago
The are a number of Windows settings for turning off what it calls "suggestions". Do a search in the Settings app for "suggest", click "Show all results" and see what comes up. Amongst them are: * Show suggesti
242.
▲
by
ChrisSD
6y ago
Ha, yes you're right. I'm on my phone and got tired of writing ones. I'll edit when I'm next at my laptop.
243.
▲
by
ChrisSD
6y ago
Fair enough. But tbh I'm not sure it really matters in this context. It's just a constant that means "ignore this parameter". Whether it's "a really big number" or "a bunch of bits that are all 1s&quo
244.
▲
by
ChrisSD
6y ago
It's meant as satire on the needlessly script heavy websites that many people create nowadays. The blog post itself isn't entirely serious either.
245.
▲
by
ChrisSD
6y ago
In Rust the simplest way would be to use the `u32::MAX` constant. Create a fun alias for it if you want to express intent.
246.
▲
by
ChrisSD
6y ago
This assumes Jobs was a particularly petty person.
247.
▲
by
ChrisSD
6y ago
Windows does allow setting it in the application's manifest but it also requires a registry setting to be enabled otherwise the manifest option is ignored. Obviously asking users to edit the registry is a non-starter so it's only
248.
▲
by
ChrisSD
6y ago
Han unification was definitely a mistake. To this day people in different countries will use different fonts so that text looks how it is supposed to in their language. The promise of unicode was that you can losslessly convert any encoding
249.
▲
by
ChrisSD
6y ago
Surrogate pairs are only in UTF-16 so as to encode code points that require more than 16 bits. UTF-8 has no need of them because it's already a variable width encoding. If there were no code points larger than 16 bits then UTF-8 would
250.
▲
by
ChrisSD
6y ago
Ah thanks! It's funny because I can't recall ever using code page 65001 before 7. Maybe there was a reason for that or maybe I simply didn't know it existed until then. Or maybe I thought it simpler to just use UTF-16. I can&
251.
▲
by
ChrisSD
6y ago
Technically it's had support since (IIRC) Windows 7. What this does is call the translation functions for you instead of having to do it yourself.
252.
▲
by
ChrisSD
6y ago
Other people have answered your question but I wanted to clarify one point. The word "character" here means "unicode code point". However, what the user thinks of as a single character can be made up of more than one cod
253.
▲
by
ChrisSD
6y ago
Personally I don't find UTF-16 to be too bad. It's a simple encoding and very easy to convert to/from UTF-8. So your program can be written in UTF-8 and your WinAPI wrappers can convert as/when needed.
254.
▲
by
ChrisSD
6y ago
Note that UTF-8 has since been restricted to at most 4 bytes (i.e. the longest sequence is `T3 Tx Tx Tx`).
255.
▲
by
ChrisSD
6y ago
Sure, I'm definitely not going to argue against some making the effort. And I don't want to sound too fatalistic. I just don't see a way for an alternative to be anything other than a tiny niche of like minded users. Which i
256.
▲
by
ChrisSD
6y ago
Many sites require JavaScript even if they don't really need it. Users won't use a no script browser because it locks them out of much of the web. Heck even web savy people find it too annoying to use the noscript addon.
257.
▲
by
ChrisSD
6y ago
Text is fine for humans. The trouble comes when you want the machine to do anything other then simply print out the literal text (and even that's tricky, what with unicode and fixed width columns). The moment you want to do something e
258.
▲
by
ChrisSD
6y ago
Nushell has a similar philosophy to powershell. They sum it up as "everything is data". Their book gives more details. https://www.nushell.sh/
259.
▲
by
ChrisSD
6y ago
Yes. Any pattern matching has to match on extended grapheme clusters or else we're back to the old "treating a string like it's 7-bit ascii" problem.
260.
▲
by
ChrisSD
6y ago
And how does that pattern matching work?
261.
▲
by
ChrisSD
6y ago
It's useful for any and all operations that involve indexing a range. Yes you locate the specific indexes by using extended grapheme clusters, but you use the retrieved byte indexes to actually perform the basic operations. These index
262.
▲
by
ChrisSD
6y ago
You seem to be thinking of the abstraction as a concrete thing. A code point is like LLVM IR; an intermediary language for describing and converting between encodings. It is not a concrete thing in itself. The concrete thing we're enco
263.
▲
by
ChrisSD
6y ago
UTF-8 is an array of bytes (8 bit integers). UTF-16 is an array of 16 bit integers. UTF-32 is an array of 32 bit integers. The machine doesn't know anything about code points. If you want to index into the array you'll need to kno
264.
▲
by
ChrisSD
6y ago
What is a string an array of? If you ask the user, it's an array of characters (aka extended grapheme clusters in Unicode speak). If you ask the machine it's an array of integers (how many bytes make up an integer depends on the
265.
▲
by
ChrisSD
6y ago
Some parsing algorithms may want to reverse the bytes but that's different to reversing the order of user-perceived characters.
266.
▲
by
ChrisSD
6y ago
> Also, DOM Strings are not UTF-16, they're UCS-16. Hm, according to the spec they should be interpreted as UTF-16 but this isn't enforced by the language so it can contain unpaired surrogates: From https://heycam.gi
267.
▲
by
ChrisSD
6y ago
The distinction between the basic plane and everything else is not particularly useful, imho. So I'm not sure I understand what the advantage of UTF-16 is here? It's an arbitrary division either way.
268.
▲
by
ChrisSD
6y ago
Personally I'd consider reversing a string to be a pretty niche use case and, as you say, it's a complex operation. Especially in some languages. Tbh I can't think of a time when I've actually needed to do that.
269.
▲
by
ChrisSD
6y ago
In summary the two useful measures of unicode length are: * Number of native (preferably UTF-8) code units * Number of extended grapheme clusters The first is useful for basic string operations. The second is good for telling you what a use
270.
▲
by
ChrisSD
6y ago
Wow, const generics were three years in the making. Longer even if you count the work leading up to the RFC. Rust's pace of change can seem very slow at times but I'm glad they take the time to do it right.
More ›