Template:Strip invisible characters: Difference between revisions
Notjusttired (talk | contribs) (add code based on Template:PMC value and characters from Module:Citation/CS1/Configuration) |
Notjusttired (talk | contribs) (add code based on Template:PMC value and CSS code values from Citation/CS1/Configuration) |
||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
{{MultiReplace|{{{1|}}}|plain=yes|FFFD||200D||200B|| 200A||00AD|­}} | {{MultiReplace|{{{1|}}}|plain=yes|FFFD||200D||200B|| 200A||00AD|­|009| |000A||00A0| |000D|<br />|007F||0000–U+001F||0080–U+009F|}} | ||
</includeonly> | </includeonly> | ||
<noinclude> | <noinclude> |
Latest revision as of 11:22, April 9, 2021
{{MultiReplace|{{{1|}}}|plain=yes|00AD|–|FFFD||200D||200B||200A||00AD||009| |000A||00A0| |000D|<br />|007F||0000–U+001F||0080–U+009F|}}
This template is designed to delete invisible characters within wikitext and uses substitution to do this.
Usage[edit source]
{{Strip invisible characters|''text string''|''linebreak''}}
Parameters:
- text string - the wikitext you want to remove invisible characters from
- linebreak - set to yes if you want to preserve line breaks, set to no to replace line breaks with a single space character, defaults to yes
Examples[edit source]
- {{Strip invisible characters|text string}} →
text string
- {{Strip invisible characters|adding soft hyphens to a very long word is a good idea, for example the longest word in the English language: pneumonoultramicroscopicsilicovolcanoconiosis pneumonoultramicroscopicsilicovolcanoconiosis pneumonoultramicroscopicsilicovolcanoconiosis pneumonoultramicroscopicsilicovolcanoconiosis pneumonoultramicroscopicsilicovolcanoconiosis}} →
adding soft hyphens to a very long word is a good idea, for example the longest word in the English language: pneumonoultramicroscopicsilicovolcanoconiosis pneumonoultramicroscopicsilicovolcanoconiosis pneumonoultramicroscopicsilicovolcanoconiosis pneumonoultramicroscopicsilicovolcanoconiosis pneumonoultramicroscopicsilicovolcanoconiosis
- {{Strip invisible characters|text string}} →
text string
- {{Strip invisible characters|text string|no}} →
text string
Invisible characters list[edit source]
The invisible characters checked for originally came from the list in Module:Citation/CS1/Configuration. The following invisible characters are removed:
Character | Unicode | Code string | Replaced with |
---|---|---|---|
replacement | U+FFFD, EF BF BD | \239\191\189 | |
zero width space | U+FFFD, EF BF BD | \226\128\139 | |
zero width joiner | U+200B, E2 80 8B | \226\128\141 | |
hair space | U+200A, E2 80 8A | \226\128\138 | |
soft hyphen | U+00AD, C2 AD | \194\173 | – ­ hyphen used to mark where to break long words |
horizontal tab | U+0009 (HT), 09 | \009 | space |
line feed | U+000A (LF), 0A | \010 | <br /> (line break) |
no-break space | U+00A0 (NBSP), C2 A0 | \194\160 | space |
carriage return | U+000D (CR), 0D | \013 | <br /> (line break) |
delete | U+007F (DEL), 7F | \127 | |
C0 control | \000-\008\011\012\014-\031 | ||
C1 control | U+0000–U+001F (NULL–US), 00–1F (except HT, LF, CR (09, 0A, 0D)) |
\194\128-\194\159 |
See also[edit source]
The above documentation is transcluded from Template:Strip invisible characters/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |