Show more

this problem, is a general problem of nesting. It happens with string escape sequence in langs. e.g. have you ever tried to grep a string that is from a code snippet's regex pattern? basically, it is impossible to figure out the backslash escape sequence.

using span tags to syntax color code on the web, now has a advantage. i.e. it's easy to determine the encoded/decoded state. (by simply checking existence of ≺span≻) So, not prone to error of encode/decode twice.

so, at this point, the advantage of using JavaScript to syntax color your code in your blog, is half gone. you still need to ampersand encode your code. and if it's web dev code (lots ≺ ≻ &), your code is unreadable without decoding. Same as using span tags to syntax color.

but why not just leave ≺ ≻ & as is without encoding at all?
That's a problem, because suppose your code process html tags.
Code that process html are actually quite common.
so if are writing programing tutorial or blog, you may have lots code snippets containing lots html tags in string or regex.

note in html4 and , all & ≺ ≻ must be encoded.
in , the rule is relaxed. if such char are surrounded by space, then it's ok, no need encoding to entities. (the rule is more complex than this)

why would it happen twice?
because when you put lots source code in html on the web, and you constantly edit
it, i.e. decode edit encode cycle,
it's very easy to make mistakes of encoding twice or decoding twice overtime.

the fact that there is no simple logical way to determine
if text is ampersand encoded or decoded, it's a problem.
because if & gets encoded twice, the code is screwed. won't run correctly anymore.

Encoded version would be:
str.replace("&", "&")

it's logically impossible to determine if a text is ampersand encoded or decoded.
you might say, if the text contains “&”, then it is encoded.
wrong!
e.g. if we have the code
str.replace("&", "&")
that's actually not encoded.

thread. been stuck on a programing problem in last 2 days. recently i tried to experiment of using google code prettify instead of span tags to color code in html. see this video
youtube.com/watch?v=ml7V_OnBAO
but now i realized a big subtle problem. not sure am going to use it anymore.

do you believe the story of supermicro spy chip used Apple Amazon server to be true?
twitter vote
twitter.com/xah_lee/status/105

𝚺 From Xah Lee's Ergomacs:

Famous Emacs Users
Famous Emacs Users ( ../misc/famous_emacs_users.html )

ergoemacs.org/misc/famous_emac

suppose joe has cow. u get milk from him. u r a comp whiz. He get his windows fixed from you. 1 day, u two had a fight. u no want joe milk anymore. Mary has milk, but mary lives far, and not as good. if u refuse joe's milk, it costs u more. he likely retaliates. hurt both ways.

in general, free trade is best. Nationalism or restrictions generally hurt both countries. but there are some details. you can understand it, by scale down the world to just your neighborhood. Who u you gonna get bread, meat, gas, employment, etc, for what you have or skill.

Show more
Mastodon

Fast, secure and up-to-date instance, welcoming everyone around the world. Join us! 🌍
Up since 04/04/2017. ✅

Why should you sign up on mstdn.io?

This instance is not focused on any theme or subject, feel free to talk about whatever you want. Although the main language is english, we accept every single language and country.

We're connected to the whole OStatus/ActivityPub fediverse and we do not block any foreign instance nor user.

We do have rules, but the goal is to have responsible users. So far we haven't had any issue with moderation

The instance uses a powerful server to ensure speed and stability, and it has good uptime. We follow state-of-the-art security practices.

Also, we have over 300 custom emojis to unleash your meming potential!


Looking for a Kpop themed instance? Try kpop.social