In computing and typesetting, asoft hyphen(UnicodeU+00ADSOFT HYPHEN(­)) orsyllable hyphen,is a code point reserved in somecoded character setsfor the purpose of breaking words across lines by inserting visiblehyphensif they fall on the line end but remain invisible within the line.
Two alternative ways of using the soft hyphen character for this purpose have emerged, depending on whether the encoded text will be broken into lines by its recipient, or has already been preformatted by its originator.[1][2][3]
Text to be formatted by the recipient
editThe use of SHY characters in text that will be broken into lines by the recipient is the application context considered by the post-1999HTMLandUnicodespecifications, as well as some word-processing file formats. In this context, the soft hyphen may also be called adiscretionary hyphenoroptional hyphen.It serves as an invisible marker used to specify a place in text where a hyphenated break is allowed without forcing aline breakin an inconvenient place if the text is re-flowed. It becomes visible only afterword wrappingat the end of a line.[4]The soft hyphen's Unicode semantics and HTML implementation are in many ways similar to Unicode'szero-width space,with the exception that the soft hyphen will preserve thekerningof the characters on either side when not visible. The zero-width space, on the other hand, will not, as it is considered a visible character even if not rendered, thus having its own kerning metrics.
To show the effect of a soft hyphen in HTML, the words of the following text (from the poemSpring and FallbyGerard Manley Hopkins) have been separated with soft hyphens:
MargaretAreYouGrievingOverGoldengroveUnleavingLeavesLikeTheThingsOfManYouWithYourFreshThoughtsCareForCanYouAhAsTheHeartGrowsOlderItWillComeToSuchSightsColderByAndByNorSpareASighThoughWorldsOfWanwoodLeafmealLieAndYetYouWillWeepAndKnowWhyNowNoMatterChildTheNameSorrowsSpringsAreTheSameNorMouthHadNoNorMindExpressedWhatHeartHeardOfGhostGuessedItIsTheBlightManWasBornForItIsMargaretYouMournFor
On HTML browsers supporting soft hyphens, resizing the window will re-break the above text only at word boundaries, and insert a hyphen at the end of each line.
Text preformatted by the originator
editThe SHY character is also used in text where paragraphs have already been broken into lines, such as certainplain textfiles, text sent toVT100-styleterminal emulatorsor printers, or pages represented inpage description languages.This is the application context originally considered by theEBCDICandISO 8859-1standards and implemented in manyVT100terminal emulators.[1][2]
Here, SHY is a visible hyphen that is usually visually indistinguishable from a regular hyphen, but has been inserted solely for the purpose of line breaking. The purpose of the soft hyphen here is to distinguish it from any regular hyphen that might have been part of the original spelling of the word. This distinction helps re-use of already formatted text, when line breaks and soft hyphens inserted during word wrapping have to be removed to convert the text back into its unformatted form. For example, the copy or paste function of aterminal emulatorcan offer to replace line breaks with aspace character,and remove any soft hyphens including any immediately followingwhitespace characters.
An example application that outputs soft hyphens for this reason is thegrofftext formatter as used on many Unix/Linux systems to displayman pages.
Encodings and definitions
editSoft hyphen (SHY) characters in coded characters sets, roughly in chronological order:
- EBCDICplaced a SHY character (known there as a "syllable hyphen" ) at position 202 (0xCAhexadecimal).[1][5]IBM defined its purpose as a "hyphen used to divide a word at the end of a line [that] may be removed when a program adjusts lines."[6]
- German standardDIN31626 defined aC1 control code setdefining 0x8D as an "Optional Syllabification Control (OSC)", a "print control character" for use marking syllable boundaries in long words. This C1 control set was registered in 1979.[7](Note: this is not the same as theISO/IEC 6429C1 control codeOperating System Command (OSC).)
- ISO 8859-1:1986 (Latin 1) inherited SHY from EBCDIC, but called it "soft hyphen", placed it at position 0xAD (hexadecimal), and stated its purpose as "for use when a line break has been established within a word". OtherISO 8859parts placed it at the same position, with the exception ofISO 8859-11(Latin/Thai), which lacks it.
- IBMcode page 850(anMS-DOScharacter set covering all ISO 8859-1 characters) placed it at position 240 = 0xF0.
- SGML's "Numeric and Special Graphic" (isonum)character entityset (ISO 8879:1986) includes
­
for the ISO 8859-1 soft hyphen. - Unicode 1.0 (1991) and ISO 10646 (1993) took the first 256 code positions from ISO 8859-1, resulting in SHY at Unicode code point of U+00AD.
- HTML2 (1995) incorporated the "­" character entity from SGML, but explicitly discouraged its use.
- HTML 4 (1999) redefined the purpose of the character as marking a hyphenation opportunity, which only becomes visible as a hyphen at the end of a line after formatting.
- Unicode 4.0 (2002) changed the category of its SHY character from previously "Pd" (punctuation, dash) to "Cf" (other, format), thereby aligning its interpretation of the character with that of HTML 4.
Other commands for marking hyphenation opportunities in text formatting languages (similar to the HTML 4 and Unicode 4.0 interpretation of SHY):
Security issues
editSoft hyphens, like other invisible characters, have been used to obscure maliciousdomainsorURLsine-mail spam.[9][10]
They are also used in emails to try to defeat spam prevention systems. For example, the phrase "I need your assistance discreetly" has a soft hyphen in the word assistance which may mean a mail system would not detect the phrase in the email body.[citation needed]
See also
editReferences
edit- ^abcJukka Korpela (January 2011)."Soft hyphen (SHY) – a hard problem?".Tampere University of Technology.Retrieved8 April2011.
- ^abMarkus G. Kuhn(4 June 2003)."Unicode interpretation of SOFT HYPHEN breaks ISO 8859-1 compatibility"(PDF).Unicode Technical Committee.L2/03-155R.
- ^Eric Muller (14 August 2002)."Yes, SOFT HYPHEN is a hard problem".Unicode Technical Committee.L2/02-279.
- ^"CSS Text Module Level 3 Specification".W3C Candidate Recommendation Draft.World Wide Web Consortium (W3C).Retrieved7 August2022.
- ^"Extended Binary-Coded Decimal Interchange Code - S/390".comsci.us.Retrieved8 April2011.
- ^"Glossary".IBM.Retrieved8 April2011.
- ^DIN(15 July 1979).Additional Control Functions for Bibliographic Use according to German Standard DIN 31626(PDF).ITSCJ/IPSJ.ISO-IR-40.
- ^"Commonly Confused Characters".Greg Baker,Simon Fraser University.Retrieved12 July2011.
- ^"Spammers Using Soft Hyphen To Hide Malicious URLs".Slashdot.7 October 2010.Retrieved8 April2011.
- ^"Soft Hyphen – A New URL Obfuscation Technique".Symantec.Retrieved8 April2011.