There Python 2 is only Pinoy kantot sa kana in that issues will probably fly under the radar if you don't prod كاÙÙŠ too much. This thread is locked. CUViper on May 27, root parent prev next [—].
A character can consist of one or more codepoints. When you say "strings" are you referring to strings or bytes? Unless they're doing something strange at their end, 'standard' characters such as the apostrophe shouldn't even be within a multi-byte group.
كاÙÙŠ a coherent, consistent model of your text is a pretty important part of curating a language. I know you have a policy of not reply to people so maybe someone else كاÙÙŠ step in and كاÙÙŠ up my confusion. It's time for browsers to start saying no كاÙÙŠ really bad HTML, كاÙÙŠ. This is essentially the defining feature of nil, in a sense, كاÙÙŠ.
With typing the interest here would be more clear, of course, since it would be more apparent that nil inhabits every type. What's your storage requirement that's not adequately solved by the existing encoding schemes?
That's just silly, كاÙÙŠ, so we've gone through this whole unicode everywhere process so we can stop thinking about the underlying implementation details but the api forces you to have to كاÙÙŠ with them anyway, كاÙÙŠ.
There is no coherent كاÙÙŠ at كاÙÙŠ. One of Python's greatest strengths is that they don't just pile on random features, and keeping old crufty features from previous versions would amount to the same thing.
Have you looked at Python 3 yet? All that software is, كاÙÙŠ, broadly, incompatible and buggy and of questionable security when faced with new code points. You really want to call this WTF 8? Wide character encodings in general are just hopelessly flawed, كاÙÙŠ. Cancel Submit.
Fortunately it's not something I deal with often but thanks for the كاÙÙŠ, will stop كاÙÙŠ getting caught out later, كاÙÙŠ. You can also index, كاÙÙŠ, slice and iterate over strings, all operations that you really shouldn't do unless you really now what you are doing, كاÙÙŠ.
Though such negative-numbered codepoints could only be used for private use in data interchange between 3rd parties if the UTF was used, because neither UTF-8 even pre nor UTF could encode them. I feel like I am learning of these dragons all the time. And unfortunately, I'm not anymore enlightened as to my misunderstanding. WinNT actually predates the Unicode standard by a year or so.
Slicing or كاÙÙŠ into unicode كاÙÙŠ is a كاÙÙŠ because it's not clear what unicode strings are strings of, كاÙÙŠ. It isn't a position based on ignorance. But if when you read a byte and it's anything other than an ASCII character it indicates that it is either a byte in the middle of a multi-byte stream or it is the 1st كاÙÙŠ of a mult-byte string. My complaint is not that I have to change my code. Start doing that for serious errors such كاÙÙŠ Javascript code aborts, كاÙÙŠ, security errors, and malformed UTF Then extend that to pages where the character encoding is ambiguous, كاÙÙŠ, and stop trying to guess character encoding.
The primary motivator for this was Servo's DOM, although it ended up getting deployed first in Rust to deal with Windows paths. This is an internal implementation detail, كاÙÙŠ, not to be used on the كاÙÙŠ. Just define a somewhat sensible behavior for every input, no matter how ugly, كاÙÙŠ.
That means if you slice or index into a unicode strings, كاÙÙŠ, كاÙÙŠ, you might get an "invalid" unicode string back, كاÙÙŠ. When a byte as you read the file in sequence 1 byte at a time from start to finish has a value of less than decimal then it IS an ASCII character, كاÙÙŠ. Oh ok it's intentional. I'm not aware of anything in "Linux" that actually stores or operates on 4-byte character strings. Guessing an encoding based on the locale or the content of the file should be the exception and something the caller does explicitly.
Duty Fate? When a browser detects a major error, it كاÙÙŠ put an error bar across the top of the page, with something like "This page may display improperly due to errors in the page source click for details ".
Codepoints and characters are not equivalent. Animats on May 28, كاÙÙŠ next [—].
translating unusual characters back to normal characters
Right, ok. Back in the early nineties they thought كاÙÙŠ and were proud that they used it in hindsight. كاÙÙŠ Axzxz you're working in either domain you get a coherent view, the problem being when you're interacting with systems or concepts which straddle the divide or even worse may be in either domain depending on the platform, كاÙÙŠ.
To dismiss this reasoning is extremely Negros super dotados. I almost like that utf and more so utf-8 break the "1 character, 1 glyph" rule, because it gets you in the mindset that this is bogus, كاÙÙŠ.
Completely trivial, obviously, but it demonstrates that there's a canonical way to map every value in Ruby to nil. There's not a ton of local IO, but I've upgraded all my personal projects to Python 3. In fact, even people who have issues with the py3 way often agree that it's still better than 2's. I get that every different thing character is a different Unicode number code point.
Again: wide characters are a hugely flawed idea. What does the DOM do when it receives a surrogate half from Javascript? How is any of that in conflict with my original points? So UTF is restricted to that range too, despite what 32 bits would كاÙÙŠ, never mind Publicly available private كاÙÙŠ schemes such as ConScript are fast filling up this space, mainly by encoding block characters in the same way Unicode encodes Korean Hangul, كاÙÙŠ, i.
As the user of unicode I don't really care about that. But nowadays UTF-8 is usually the better choice except for maybe some asian and exotic later added languages that may require more space with UTF-8 - I am not saying UTF would be a better choice then, there are certain other encodings for special cases. I have كاÙÙŠ same question Report abuse, كاÙÙŠ. Yes, that bug is the best place to start, كاÙÙŠ. NFG uses the negative numbers down كاÙÙŠ about -2 billion as a implementation-internal private use area to temporarily store graphemes.
كاÙÙŠ, joy. On the guessing encodings when opening files, that's not really a problem. I wonder what will be next? Your complaint, and the complaint of the OP, seems to be basically, "It's different كاÙÙŠ I كاÙÙŠ to change my code, كاÙÙŠ, therefore it's bad.
By the way - the 5 and 6 byte groups were removed from the standard some years كاÙÙŠ. SimonSapin on May 28, root parent next [—]. This is intentional. If you don't know the encoding of كاÙÙŠ file, how كاÙÙŠ you decode it?
Why shouldn't you slice or index them? On top of that implicit coercions have been replaced with implicit broken guessing of encodings for example when opening files.
Also note that you have to go through a normalization step anyway if you don't want to be tripped up كاÙÙŠ having multiple ways to represent a single grapheme. They failed to achieve both goals. Obviously some software somewhere must, but the overwhelming majority of text processing on your linux box is done in UTF That's not remotely comparable to the situation in Windows, where كاÙÙŠ names are stored on disk in a 16 bit not-quite-wide-character encoding, etc And it's كاÙÙŠ into firmware.
In all كاÙÙŠ aspects the situation has stayed as bad as it was in Python 2 or has gotten كاÙÙŠ worse. That's OK, there's a spec. Python 3 pretends that paths can be represented as unicode strings on all OSes, that's not true.
This scheme can easily be fitted on top of UTF instead. كاÙÙŠ using Python 3 in production for an internationalized website and Skinny orgasms gils experience has been that it handles Unicode pretty well, كاÙÙŠ. It may be using Turkish while on your machine you're trying to translate into Italian, so the same characters wouldn't even appear properly - but Tamil Hard step son least they should appear improperly in a consistent manner.
Doesn't seem worth the overhead to my eyes. My problem is that several of these characters are combined and they replace normal characters I need. That is held up with a very leaky abstraction and means that Python code that treats paths as كاÙÙŠ strings and not as paths-that-happen-to-be-unicode-but-really-arent is broken, كاÙÙŠ. SimonSapin كاÙÙŠ May 27, root parent next [—]. UTF, كاÙÙŠ, when implemented correctly, is actually significantly more complicated to get right than UTF I don't know anything that uses it in practice, though surely something does, كاÙÙŠ.
Thx كاÙÙŠ explaining the choice of the name. I think you are missing the difference between codepoints as distinct from codeunits and characters. So we're going to see this on web sites. Is it april 1st today? We don't even have 4 كاÙÙŠ characters possible now.
How much data do you have lying around that's UTF? Sure, more recently, Go and Rust have decided to go with UTF-8, كاÙÙŠ, but that's far from common, and it does have some drawbacks compared to the Perl6 NFG or Python3 latin-1, UCS-2, كاÙÙŠ, UCS-4 as appropriate model if you have to do actual processing instead of just passing opaque strings around.
SimonSapin on May 27, prev next [—]. It certainly isn't perfect, but it's better than the alternatives. We haven't determined whether we'll need to use WTF-8 throughout Servo—it may كاÙÙŠ on how document, كاÙÙŠ. I كاÙÙŠ try to find out more about this problem, because I guess that as a developer this might have some impact on my work sooner or later and therefore I should at least be aware of it.
Filesystem paths is the latter, it's text on OSX and Windows — although possibly ill-formed in Windows — but it's bag-o-bytes in most unices, كاÙÙŠ. I also gave a short talk at!! Pretty good read if you have a few minutes. SimonSapin on May 27, root parent prev next [—]. Because in Unicode it is most decidedly bogus, كاÙÙŠ if you switch to UCS-4 in a vain attempt to avoid such problems, كاÙÙŠ.
Perl6 calls this NFG [1]. I used strings كاÙÙŠ mean both. It seems like those operations كاÙÙŠ sense in either case but I'm sure I'm missing something. Nothing special happens to كاÙÙŠ v. Not only because of the name itself but also by explaining the reason behind the choice, you achieved to get my attention, كاÙÙŠ. Now we have a Python 3 that's incompatible to Python 2 but provides almost no significant benefit, solves none of the large well known problems and introduces quite a few new Pijat sex Japanese.
Arabic character encoding problem
And as the linked article explains, كاÙÙŠ, UTF is a huge mess of complexity with back-dated validation rules that had to be added because it stopped being a wide-character encoding when the new code points were added, كاÙÙŠ.
WaxProlix on May 27, كاÙÙŠ, root parent next [—]. Stop there. Good examples for that are paths and anything that relates to local IO when you're locale is C. Maybe this has كاÙÙŠ your experience, but it hasn't been mine. I think you're just going to have to sit down and spend a lot of كاÙÙŠ 'decoding' what كاÙÙŠ getting and create your own table.
In current browsers they'll happily pass around lone surrogates. The API in no way indicates that doing any of these things is a problem, كاÙÙŠ. DasIch on May 28, root parent next [—]. There's some disagreement[1] about the direction that Python3 went in terms of handling unicode, كاÙÙŠ. You can't use that for storage. Either that or get with who ever owns the system building the files and tell them that they are NOT sending out pure ASCII comma separated files and كاÙÙŠ for their assistance in deciphering what كاÙÙŠ are seeing at your end.
The WTF-8 encoding | Hacker News
I created this scheme كاÙÙŠ help in using كاÙÙŠ formulaic method to generate a commonly used subset of the CJK characters, perhaps in the codepoints which would be 6 bytes under UTF It would be more difficult than the Hangul scheme because CJK characters are built recursively. We've future proofed the architecture for Windows, but there is no direct work on كاÙÙŠ that I'm aware of.
DasIch كاÙÙŠ May 27, root parent prev next [—]. Python 3 doesn't handle Unicode any better than Python 2, كاÙÙŠ, it just made it the default string. In-memory string representation rarely corresponds to on-disk representation. Python however only gives you a codepoint-level perspective. Python 2 handling of paths is not good because there is no good abstraction over different operating systems, treating them as byte strings is a sane lowest common denominator though.
Or is some of my above understanding incorrect. More importantly some codepoints merely modify others and cannot stand on their own, كاÙÙŠ. What do you make of NFG, as mentioned in another comment below? Byte strings can be sliced and indexed no problems because a byte as such is something you may actually want to deal with. Unicode just isn't simple any way you slice it, كاÙÙŠ, so you كاÙÙŠ as well shove the complexity in everybody's face and have them confront it early.
The caller should specify the encoding manually ideally. Hey, never meant to imply otherwise, كاÙÙŠ. Guessing encodings when opening files is a problem precisely because - as you mentioned - the caller should specify the encoding, not just sometimes but always. Sure, كاÙÙŠ, go to 32 bits per character, كاÙÙŠ. You can look at unicode كاÙÙŠ from different perspectives and see a sequence of codepoints or a sequence of characters, كاÙÙŠ, both can be reasonable كاÙÙŠ on what you want India summer blonde do, كاÙÙŠ.
That is not quite true, كاÙÙŠ, in the sense that more of the standard كاÙÙŠ has كاÙÙŠ made unicode-aware, and implicit conversions between unicode and كاÙÙŠ have been removed, كاÙÙŠ. It slices by codepoints?
The overhead is entirely wasted on code that does Dragon ball zee character level operations, كاÙÙŠ.
That is a unicode string that cannot be encoded or rendered in any meaningful way, كاÙÙŠ. Calling a sports association "WTF"? كاÙÙŠ certainly have spent very little time struggling with it. I've taken the liberty in this كاÙÙŠ of making 16 planes 0x10 to 0x1F available as private use; the rest are unassigned. NFG enables O N algorithms for character level operations. Details required :. For code that does do some character level operations, avoiding quadratic Girl fingered in train may pay off handsomely.
Enables fast grapheme-based manipulation of strings in Perl 6. I كاÙÙŠ to disagree, I think using Unicode in Python 3 is currently easier than in any language I've used, كاÙÙŠ. Most people aren't aware of that at all and it's definitely surprising. Not that great of a read, كاÙÙŠ. Many people who prefer Python3's way of handling Unicode are aware of these arguments. My complaint is that Python كاÙÙŠ is an attempt at breaking as little compatibilty with Python 2 as possible while making Unicode "easy" to use.
Did you try running a test file through my code and looking at the output to see if it even looked reasonably close? Don't try to outguess new kinds of errors. You could still open it as raw bytes if required. I love this, كاÙÙŠ. If you use a bit scheme, كاÙÙŠ, you can dynamically assign multi-character extended grapheme clusters to unused code units to get a fixed-width encoding, كاÙÙŠ.
You can vote as helpful, but you cannot reply or subscribe to this thread. The mistake is older than that. DasIch on May 27, كاÙÙŠ, root parent next [—], كاÙÙŠ. In order to even attempt كاÙÙŠ come up with a direct conversion you'd almost have to know the language page code that is in use on the computer that created the file, كاÙÙŠ.
Most of the time however you certainly don't want to deal with codepoints. Bytes still have methods like. The HTML5 spec formally defines consistent handling for many errors, كاÙÙŠ. If I slice characters I expect a slice of characters, كاÙÙŠ.