Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You could use a pattern of one or two spaces after each sentence. Encode an id in that. If text is copy and pasted and not processed with a s/ / /g, that most likely won't be detected by the copy-and-paster (especially when it's all done in a variable width font).


Looks like HN does remove double spaces, what I meant was obviously s/[space][space]/[space]/g :)


It's not HN, it's a feature of HTML. All whitespace characters (including tabs and newlines) are condensed to a single space, and leading/trailing spaces are removed. So if you have a habit of double-spacing after sentences, HTML simply ignores you, unless you use <pre> or &nbsp;.


Ah didn't know that. Well that would make the single/double space encoding of an id much harder.


Actually, it makes it more effective if anything. The browser displays it as a single whitespace, but the source isn't altered, (and therefore easily checkable).


Yeah but if a user copy/pastes it from his email client into his blog posting system, the double spaces are stripped, too (I checked it with Firefox, maybe other browsers work differently). It would only work I think if the single/doubles space pattern was preserved across copy/paste operations.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: