3 ms·
Ah, you’re right; thanks for the correction. The article does contain an error here, for the code point on the page is actually U+FFFD, not U+D83D (which of co
by chrismorgan 7y ago
Ah, you’re right; thanks for the correction.
The article does contain an error here, for the code point on the page is actually U+FFFD, not U+D83D (which of course is unrepresentable there). I trusted that (being a little surprised that it’d do the replacement, which is more what I’d expect of Python, but accepting it all the same) and didn’t pull out an old browser to confirm what actually happens, which is, as you say, an unpaired surrogate code point.
The article should probably say '"\ud83d"' instead of '"�"' (even though the number of backslashes still then requires thought), because yielding U+FFFD there would be a completely valid (and preferable, in my opinion) solution.
- uncletaco 7y agoI love when the reaction to being wrong is to explain how the thing is responsible for their error and so they waste a few sentences explaining how it could have avoided leading then astray.
- masklinn 7y ago> The article does contain an error here, for the code point on the page is actually U+FFFD, not U+D83D (which of course is unrepresentable there). The MDN page also does that, that's a bit misleading but TFA commits way worse a sin: it actually states the unpaired codepoint is swapped for the replacement character: > In earlier versions, these would be replaced with a special character: which is just wrong. > yielding U+FFFD there would be a completely valid (and preferable, in my opinion) solution. I agree. The proposal does not explain whether U+FFFD was considered, I expect they picked the escaped version to limit or avoid data loss: if you get an U+FFFD you have no idea what it used to be.
- burpsnard 7y agoI'm suddenly reminded of the hours i spent noodling around with sgml.xml entity catalogues (™ © etc)