Recently, a problem happened online. My colleague told me that a user name was wrong and the re verification failed.

So I went to the database to look at the user’s name information, looks like this.

Did not look carefully seems to have no problem ah, but carefully looked twice found that seems not quite right, how this word so wide?

Oh, my god, this tower is like a full horn!

The specific reason is because the inserted name is full Angle, so that other places to call the interface name using the re to determine the failure.

To fix this problem, it is very simple to update the name with the font of half corner again. In addition, the front end is checked, and the back end is not checked with the re. This verification logic needs to be filled.

But this is a weird question, isn’t there a check between the full Angle and the half Angle?

Curious, I tested the registrations on Taobao, Tencent and Toutiao to see if I could save the whole corner.

First of all tried taobao, red box I input is the phone number of the whole corner, it is not obvious that the whole corner.

Try QQ registration again, the discovery is also not possible, this is very good, we do not want the full Angle.

The problem here is actually very clear, before and after the end of the registration must have omitted the logic of this check, make up.

I retested the re for matching English:

varp =/^[A-Za-z0-9]+$/g
p.match('qqq')/ / output true
p.match(': QQQ)/ / output is false
Copy the code

So it is suggested that you can make up a regular check without checking machine number, name and so on, to prevent the database data is full Angle, to avoid pit dad.

This will cause a lot of problems, for example, if the full corner of the mobile phone number saved, adjust the interface to send mobile phone verification code, others check is half the corner of the rule, you send verification code are wrong!

The problem all said, might as well understand again what is the full Angle? What is a half Angle?

Used input method we have certainly seen, but the specific difference may really do not know.

There are corresponding explanations in GB/T 9851.2-2008 Printing Technical Terms Part II: Prepress Terms:

2.31 A unit of measurement for full-angle EM typesetting equal in width to the pounds (points) of text used and used as a horizontal measure of typesetting width.

2.32 A unit of typesetting equal in width to one half of the full Angle of the same pound.

As we all know, our Chinese fonts are all square characters, including typesetting, so the width of each character in our Chinese characters is the same.

But in English, the width of an English letter may be different, so the concept of full corner/half corner was born to serve the English language.

It simply represents the concept of font width.

In fact, the concept of full corner/half corner comes from Japan, where the word “Angle” means square, so full corner/half corner means whole square/half square.

This also has many names, such as whole body/half body, Hong Kong and Taiwan area called full/half shape, but in any case, these names are in the printing industry terminology.

But then, with the development of computers, it seems that we technology people don’t understand this stuff, directly moved the whole corner/half corner to use, and thus formed the situation we know today.

As we all know, when ASCII was first introduced to map the binary to the English alphabet, it was only 1 byte and could only represent 256 symbols at most, and English didn’t run out of characters either, using only 128.

But for Chinese and many other languages, 256 symbols is definitely not enough, so what to do? Then you can only use two bytes.

Therefore, as users get used to using it, they gradually get used to treating the full corner as double-byte Chinese and Korean, and the half corner as English.

In the early days of computing, the concept of full corner/half corner was roughly equivalent to a single byte/double byte, as well as the width we mentioned above. Full corner means twice as much width as half corner.

Of course, with the development of computing, and the birth of GB2312, GBK, Unicode, UTF-8 these codes, such as GBK Chinese and English are two bytes, UTF8 below 3 bytes, now the concept of full corner/half corner and the size of the storage space has no relationship.

So summary down ah, call source in Japanese Angle of full/half Angle, but was the wrong directly into technology (printing industry said that I didn’t know you so cow force), the initial Angle of full/half Angle is on behalf of the width of the meaning, has also been established to give the meaning of double byte/single-byte, now it can only be user stories width more appropriate point.

And ah, do a good job of the parameters of the code verification, the library on the trouble, otherwise have to brush the same as I go through the data!

References:

Zh.wikipedia.org/wiki/%E5%85…

www.thetype.com/2018/02/142…