About external improvements

Do you know Outline?

Lately, I started using it to skip over so called soft paywalls. It works most of the times.

But today, unexpectedly, it resuscitated dead content too!

Look at the following snapshot of a passage in an interesting article about software architecture with microservices:

https://segment.com/blog/goodbye-microservices/

Look at how the second paragraph ends: “A sample payload looks like the following:” and how the next paragraph begins: “As events were consumed from the queue,“. Something is clearly missing. Where is the payload sample? Nowhere to be found.

Completely unrelated to that issue, I decided to open the page in outline, because I remembered I had seen it was possible to add annotations to transformed pages.

To open a page in Outline is extremely simple, just prefix its full URL with “https://outline.com/” and the service will present to you the transformed page at that URL.

What a surprise when I scrolled through the same passage and saw this:

https://outline.com/asskU

For some reason, Outline was able to resuscitate the dead content, but it got the section title wrong. (sigh, a minor drawback).

Do you know the Web Archive?

I researched a bit in its captures of the microservices article (almost 200, as of today) and found out that the payload content died between the 28th of March 2020 and the 23rd of April 2020, as yo can see from these captures:

28 March 2020

https://web.archive.org/web/20200328190530/https://segment.com/blog/goodbye-microservices/

23 April 2020

https://web.archive.org/web/20200423005607/https://segment.com/blog/goodbye-microservices/

But, wait a moment. Look at the section title in the capture of the 28th of March: “Why Microservices work worked”. Outline’s error seems so much minor now. So much so that the original page got it wrong too.

Do you know Hypothes.is?

I was going to end this article with a link to the Outline page with my worthy annotations, but it turns out that Outline URLs are broken, apparently. This page https://outline.com/asskU doesn’t work today.

However, the annotation service is provided by Hypothes.is. If you have Google Chrome, you can install their excellent browser extension, and navigate to the “official” Segment article to see my annotations, and add yours, if you like.

My annotation is here

Backup of a WordPress plugin / theme directory.

I often think: I’m just gonna do this little thing before and then I continue doing that.

The last little thing spanned a couple of days. I needed to make a patch for WordPress and cross fingers after pleading to apply it.

I could be wrong, but some years ago it was considered best practice to have users of your plugin to store their customizations into the same plugin directory. Well, maybe nobody advised me to but nobody advised me against either. The point is that it looks really neat to make users store all the stuff related to your plugin in the same place where your plugin leaves.

Years ago, however, there was no problem. Whenever you wanted to install a new plugin or update an old one, you always needed to first download it to your PC and then to upload it to your remote site, into the ´/wp-content/´ directory, possibly by means of an FTP client. The process was repetitive and cumbersome, but exactly by virtue of that you did things orderly.

Always make a backup of the stuff you are going to replace.

That was the mantra. Even on toilet walls you could read it.

Then, the update now link appeared and it all changed, for better. No more nothing, just a simple click and … magically everything happened remotely. Really really good feature. But there was a problem. A no-feature became a feature (bug?). The magic update now functionality never makes a backup of what is gonna replace. Why? I really don’t know. It is still a mantra for me!

So, the last couple of days, I made a patch for WordPress 4.1 and submitted it minutes ago. It’s quite simple: Always make a backup of the stuff you are going to replace. Then a plugin / theme developer can access a backup of their previous stuff and transparently migrate the previous custom files to the new version. For example, from an activation hooked function:

{[ .example | 1.hilite(=php=) ]}

WordPress and UTF-8

We know that WordPress cannot manage 4-bytes-long UTF-8 characters since the bug report Inserting a 4-byte UTF-8 character truncates data was filed on May 28, 2010. As of today (four years later) #13590 is still not fixed.

I contributed first a patch for fixing the bug on January 19, 2011 and then a plugin for fixing WP sites on May 25, 2011. They work in a very simple way:

  1. immediately before writing to the database, a 4-bytes-long UTF-8 character is converted to a safe code
  2. immediately after reading from the database, a safe code is converted to a 4-bytes-long UTF-8 character

Escaping / unescaping is very useful because PHP, which can manage 4-bytes-long UTF-8 characters, will manage them and MySQL, which cannot manage them (*), will manage a safe code instead.

There are only a couple of issues with this method, though. If a string contains some 4-bytes-long UTF-8 characters then

  1. the length of the string in PHP will appear lower than in MySQL
  2. the order of the string in PHP will be different from MySQL

For me, they are minor problems, when compared to the peace of mind of being able to paste or edit whatever UTF-8 text I might come up with.

As I said, #13590 is still not fixed after 4 years. Meanwhile,

  1. 2010-05-28 06:53 – #13590 opened – sardisson filed Inserting a 4-byte UTF-8 character truncates data
  2. 2010-10-27 12:28 – #13590 – Component changed from General to Charset – Milestone changed from Awaiting Review to Future Release
  3. 2010-12-31 13:21 – #13590 closed – Resolution set to invalid – Status changed from new to closed
  4. 2011-01-13 02:55 – #13590 – Milestone Future Release deleted
  5. 2011-01-19 09:32 – #13590 reopened – Component changed from Charset to Database – Keywords utf8 added – Resolution invalid deleted – Status changed from closed to reopened – Summary changed from Inserting a tetragram (SMP/Plane 1) character truncates post fields to Inserting a 4-byte UTF-8 character truncates data – Version changed from 2.9.2 to 3.0.4
  6. 2011-01-19 09:57 – #13590 – Milestone set to Awaiting Review
  7. 2011-01-19 21:40 – #13590 – Attachment wp-db-utf8-patch.diff​ added (my patch)
  8. 2011-05-25 – I published my plugin
  9. 2011-05-25 21:43 – #13590 – Keywords has-patch added – Type changed from defect (bug) to enhancement
  10. 2012-07-11 04:26 – #21212 opened – Gary Pendergast (pento) filed MySQL tables should use utf8mb4 character set, basically suggesting to take advantage of utf8mb4, which is how MySQL developers fixed their bug. (*)
  11. 2012-08-08 06:49 – #13590 – Milestone changed from Awaiting Review to 3.5
  12. 2012-08-29 01:54 – #13590 closed – Keywords utf8 removed – Milestone 3.5 deleted – Resolution set to maybelater – Status changed from reopened to closed – Version changed from 3.0.4 to 2.9.2
  13. 2013-02-18 21:36 – #13590 – Duplicated by #23495
  14. 2012-07-11 04:28 – #21212 – Attachment 21212-utf8mb4.diff​ added
  15. 2012-07-11 04:29 – #21212 – Keywords has-patch added
  16. 2012-07-11 11:22 – #21212 – Related to #13590
  17. 2012-07-18 06:52 – #21212 – Attachment 21212-utf8mb4.2.diff​ added
  18. 2012-07-30 – Mathias Bynens published How to support full Unicode in MySQL databases
  19. 2012-08-07 04:13 – #21212 – Attachment 21212-utf8mb4.3.diff​ added
  20. 2012-08-07 05:06 – #21212 – Milestone changed from Awaiting Review to 3.5
  21. 2012-08-07 06:39 – #21212 – Keywords commit added
  22. 2012-08-29 01:54 – #21212 closed – Milestone 3.5 deleted – Resolution set to maybelater – Status changed from new to closed
  23. 2012-10-09 05:24 – #21212 reopened – Keywords has-patch commit removed – Resolution maybelater deleted – Status changed from closed to reopened
  24. 2012-10-09 06:56 – #21212 – Milestone set to Awaiting Review
  25. 2014-04-07 – Gary Pendergast (pento) published WordPress and UTF-8
  26. 2014-04-22 02:08 – #21212 – Duplicated by #27961
  27. 2014-06-11 – Andrew Nacin (nacin) and core WP developers started thinking about a fix.
  28. 2014-08-22 15:47 – #21212 – Duplicated by #29322
  29. 2014-09-28 13:20 – #21212 – Duplicated by #29773
  30. 2014-10-04 18:49 – #21212 – Duplicated by #29857

FWIW, since I’ve been using my plugin I forgot about WordPress and UTF-8.