ifeilong / feilong

让Java开发更简便的工具库
Apache License 2.0
118 stars 30 forks source link

新建 com.feilong.core.lang.StringUtil.clean(CharSequence) 订单信息的address隐含’ backspace‘ '\b'信息导致HUB不能解析订单 #55

Closed venusdrogon closed 1 year ago

venusdrogon commented 4 years ago

解密之后的字符串copy到编辑器里面包含‘backspace’的隐藏字符,如图:

image

image

而后端hub接收到数据后会转换为xml,他们不支持,导致报错

https://stackoverflow.com/questions/48568885/what-is-the-use-of-b-backspace4

Backspace is a control character that moves the cursor one character back in the console but doesn't delete it.

What's the reason for the backspace character, and how might it be used?

It was used historically in the ASCII world to print accented characters.

For example à could be produced using the three character sequence a Backspace ` (or, using the characters' hex values, 0x61 0x08 0x60).

Backspace key vs Backspace character

A lot of people confuse the two.

venusdrogon commented 4 years ago

image

'\b' only deletes when printing to a terminal (and not necessarily all terminals, though common *NIX shells and cmd.exe should work). If the output is going to a file (or anywhere else besides a terminal), it's going to insert the literal ASCII backspace character.

image

venusdrogon commented 1 year ago

https://www.asciihex.com/character/control/8/0x08/bs-backspace


About BS


Integer ASCII code: | 8 -- | -- Binary code: | 0000 1000 Octal code: | 10 Hexadecimal code: | 08 Group: | control Seq: | ^H C/C++ notation: | \b or '\b'
Back to ASCII table

 2018-2022 © Dmytro Koshovyi. Ukraine, Mykolayiv.

[ASCII HEX](https://www.asciihex.com/) [Home](https://www.asciihex.com/) [Table](https://www.asciihex.com/ascii-table) [Control codes](https://www.asciihex.com/ascii-control-characters) [Printable chars](https://www.asciihex.com/ascii-printable-characters) [[Donate]](https://koshovyi.com/support) [Contacts](https://www.asciihex.com/contacts) ASCII CHARACTER #8. CHAR BS - BACKSPACE About BS Integer ASCII code: 8 Binary code: 0000 1000 Octal code: 10 Hexadecimal code: 08 Group: control Seq: ^H C/C++ notation: \b or '\b' Unicode symbol: ␈, int code: 9224 (html ␈) hex code: 2408 (html ␈) Information Place the cursor one position to the left. This operation may erase the character that is placed leftwards of the cursor in output. Before discussing the output, let's remember some history. If you printed the character in early computer technology you couldn't erase it, so in output backspace was sometimes used in the function of generating accented characters in ASCII. Let's see: à could be produced using the three character sequence a BS ` (or, using the characters' hex values, 0x61 0x08 0x60). Nowadays this thing is widely criticized and not supported at all. In order to get rid of any ambiguity between the two possible uses of backspace, programmers decided to make a cancel character control code a part of the standard C1 control set. Let's move on to the backspace. It is a keyboard key with the initial function of pushing the typewriter carriage one position backwards. Nowadays in modern computer systems backspace moves the display cursor one position backwards, deletes the character at that position, and shifts back the text after that position by one position. Typewriter In some typewriters there was a long system of typing. Let's see an example. How could a typist create a lowercase letter A with acute accent (á). First he or she had to type a lowercase letter A, press backspace, and then the acute accent key. This method is also called an overstrike. It is the basis for such spacing modifiers in computer character sets such as the ASCII caret (^, for the circumflex accent). Nowadays backspace composition is out of use with typical digital displays or typesetting systems that we use nowadays. We can say that it was partially replaced with the combining diacritical marks mechanism of Unicode, despite the fact that such characters don't perfectly work with lots of fonts. That's why the precomposed characters continue to be used. There is an opposite method for diacritical marks, which is used by some software (like TeX or Microsoft Windows). It is the following: namely positioning the accent first, and then the base letter on its position. Computers Everybody knows what does the term "backspace" means, as well as knows its primer function: to delete the character to the left of the cursor. However, the actual key may be called in many different ways, for example delete, Erase (for example in One Laptop Per Child), or with a left pointing arrow. A special symbol for "backspace" exists as U+232B ⌫ but its use as a keyboard label is not universal. The backspace and the delete key are two different keys. In paper media for computers the delete key would knock out all the holes to cross out a character. In nowadays computers deletes text following it. Besides, the delete key has one more function: it frequently works as a generic command to remove an object (for example an image inside a document, or a file in a file manager), while backspace usually does not. Common use The backspace key is often matched to the delete character (0x7f in ASCII or Unicode) in modern systems. However, the backspace primer function, deleting the character before the cursor, remains. The backspace key is usually used to go back a page or up one level in graphical web or file browsers. Hash MD5 Backspace input value base output hash BS char E2BA905BF306F46FACA223D3CB20E2CF 8 dec C9F0F895FB98AB9159F51FD0297E236D 00001000 bin AE99C9B6996BD77564AB8A5F876D8E15 0000 1000 bin 7ACC5458D7F795147F93B7274BEAB8EA 10 oct D3D9446802A44259755D38E6D163E820 08 hex FAD6F4E614A212E80C67249A666D2B09 0x08 hex 5990EF66795D77D0F998B066ED0338C9 SHA256 Backspace input value base output hash BS char BEEAD77994CF573341EC17B58BBF7EB34D2711C993C1D976B128B3188DC1829A 8 dec 2C624232CDD221771294DFBB310ACA000A0DF6AC8B66B696D90EF06FDEFB64A3 00001000 bin 95100B3F99837D6C1C8B742697E20F1C16378972771B8FC18DE979F437D292B4 0000 1000 bin A08E3E8302C18B7A040413230F5D32ACC392E1F551C9607FF8D5AC9312B52B10 10 oct 4A44DC15364204A80FE80E9039455CC1608281820FE2B24F1E5233ADE6AF1DD5 08 hex 323783BE9A53A31E158EC9600626A4703E99F4E183BC1ACB8772CBDF5C3A1ECE 0x08 hex 1EC89870D1D54B0F5870D24AC30B9567AC230E3ABFEB73AA6D0358DD19A6306B Base64 Backspace input value base output hash BS char CA== 8 dec OA== 00001000 bin MDAwMDEwMDA= 0000 1000 bin MDAwMCAxMDAw 10 oct MTA= 08 hex MDg= 0x08 hex MHgwOA== [← Previous char 'BEL', code: 7](https://www.asciihex.com/character/control/7/0x07/bel-bell-alert)[Next char 'HT', code: 9 →](https://www.asciihex.com/character/control/9/0x09/ht-character-tabulation-horizontal-tabulation) [Back to ASCII table](https://www.asciihex.com/ascii-table) 2018-2022 © [Dmytro Koshovyi](https://koshovyi.com/). Ukraine, Mykolayiv.