A user, jeff5-really, reported that their RSS subscription to the “users” category on the Python Discourse had stopped working due to invalid content. The issue was traced back to a post containing an unexpected character (b'N \x02x KSQT') that was not visible in the post itself, but appeared in the RSS feed.
sam investigated the issue and found that the problematic string was not immediately apparent. However, simon reported that there was a Unicode hex code (☐) in the post earlier that day, which had since been edited out.
Falco identified the faulty character as  (U+0002), a control character that is invalid in XML 1.0. jeff5-really confirmed that this character was present in the post and was causing the issue.
A pull request (#24001) has been submitted to address this issue, which aims to ensure that the RSS feed is XML 1.0 compliant and does not contain invalid control characters.
On the Python Discourse I noticed that my RSS subscription to the users (renamed “Help”) category had stopped working. On trying to re-establish it, the subscription https://discuss.python.org/c/users/7.rss results in invalid content that my reader (Thunderbird) will not load. It fails validation at W3C:
Since that check fails, I assume I’m not the only one affected.
The problem seems to be an unexpected character in the post https://discuss.python.org/t/beginner-help-with-concatenating-arrays/36226. In the feed, the offending sub-string comes out as b'N \x02x KSQT' (two occurrences).
It’s not that user’s fault, of course, but Discourse’s for letting it through, and the long-term fix lies with you.
An admin there (or at least a CPython core dev) suggested I report it here.
PrettyText.format_for_email(p.cooked, p)
=> "<p>Hello, I’m currently trying to follow a machine learning pipeline described by a paper. Essentially, I need to create an input matrix which is shaped N x KSDT sized. The paper describes this as: “Here k, ks, kd, and ksd are labels and not indices, and all terms are understood to be matrices of the same N x KSQT size, so e.g. Xk is not an N x K sized matrix, but the full-size N x KSQT matrix with N x k unique values replicated KSQ times”.</p>\n<p>Right now, I have three following np.arrays:<br>\nbias_block: (348, 2, 151), bias_contrast: (348, 5, 151), and bias_decision: (348, 2, 151).<br>\nMy understanding is that in order to combine these three arrays, I would need a final size of (348, 20, 20, 20, 151). However, I’m really struggling on how to combine these arrays. Could someone please help with this, thanks a lot.</p>"
I am not seeing what is wrong with that string … the N x KSDT does not appear to have anything hiding there.
(note the post has now popped out of latest, so rss is back and working as a side effect, but I certainly would like to fix this.
I am assuming this is the line where this originates from:
I looked at the post earlier today. There was a unicode hex code in it that was something like ☐ (☐). That’s not the exact code though. It was showing up in the post’s raw content this morning (https://discuss.python.org/posts/121311.json). Seems to have been edited since then.
The first occurrence is ok, but the second and third contain an 0x02 byte (when I save from this URL using Firefox and read the file as bytes using Python), as in my first post. validator.w3.org gave me enough context to locate the first 0x02 in the line.
U+002610 is just the box symbol that something is replacing it with (but not in the RSS).
I asked for the post to be repaired as I didn’t see me getting my subscription working without. I can send you my saved bytes if it would help.