UNIBETACODE(5)
π UNIBETACODE(5) π
okay bestie, welcome to unibetacode β the format for polytonic Beta Code files β and yes, that's the whole manual name, section 5, File Formats Manual, we're doing this. grab a strawberry drink π and let's go, because this one is a whole saga and honestly? iconic.
β¨ NAME β¨
unibetacode β the format for polytonic Beta Code files. π
β¨ SYNOPSIS β¨
source_file.beta
like... that's it. that's the whole vibe. a file. ending in .beta. slay. π
β¨ DESCRIPTION β¨
so Unibetacode is an implementation of Beta Code, the way the University of California, Irvine Thesaurus Linguae Graecae (TLG) Program adopted it, and the Tufts University Perseus Project, among others. no cap.
what even is Beta Code? it's a way of encoding polytonic Greek characters using plain ASCII characters. that's the whole trick. ASCII in, fancy Greek out. β¨
the unibetacode package ships three utility programs:
unibetaprep(1)β converts TLG-unique numeric codes to Unicode code pointsbeta2uni(1)β converts a Beta Code file to UTF-8 Unicodeuni2beta(1)β converts a UTF-8 Unicode file to Beta Code
these programs can also process Coptic and some Hebrew, but historically the focus of Beta Code documents has been classical Greek. ποΈ
and there's more β the package also contains libunibetacode, which provides functions for conversion between Beta Code and UTF-8 Unicode. library girlies, we see you. π«Ά
okay now, important vocab moment: a Unicode code point is an assignment to a specific numeric value for glyphs and other entities in Unicode fonts. throughout this document, Unicode code points are given by their Unicode numeric values in the form U+xxxx, where "xxxx" is a string of four hexadecimal digits representing a glyph in the Unicode Basic Multilingual Plane. that's the notational convention in The Unicode Standard and elsewhere. iykyk. π
Note: Thesaurus Linguae Graecae and TLG are registered trademarks of the University of California. π legal girlies said "don't forget."
β¨ GENERAL PUNCTUATION β¨
πΈ PUNCTUATION COMMON TO ALL MODES πΈ
regardless of the language mode β Greek, Latin, Coptic, or Hebrew β several punctuation marks are retained as is between the input file and the output file. no glow-up, no transformation, they just pass through. they are as follows:
.β Full Stop (Period),β Comma?β Question Mark (except in Greek mode, where it becomes a Combining Dot Below π)!β Exclamation Mark;β Semicolon / Greek Question Mark (see the Greek section below)[ ]β Square Brackets
π QUOTATION MARK STYLES π
okay so the TLG Beta Code specification supports nine different styles of quotation mark. nine!! and while support of different styles is beneficial, this complicates round-trip conversion from Beta Code to Unicode and back. the drama gets worse because the same Unicode character gets used as an opening quotation mark in one style and as a closing quotation mark in another style. it's giving chaos. π
double quotes in the unibetacode package just use ASCII quotation marks in a Beta Code source file; the quotation style is determined by the language mode. this greatly simplifies round-trip conversion between Beta Code and a Unicode UTF-8 document. π
double quotation marks must be balanced. the first quotation mark encountered will be interpreted as a left quotation mark for the chosen style, the second will be interpreted as a right quotation mark, and so on. alternating, forever, like a lil dance. π¦
double quotation marks are converted as follows:
- Greek, Coptic β the opening double quotation mark is rendered as
U+00AB, LEFT-POINTING DOUBLE ANGLE QUOTATION MARK. the closing double quotation mark is rendered asU+00BB, RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK. - Hebrew β the opening double quotation mark is rendered as
U+201E, DOUBLE LOW-9 QUOTATION MARK. the closing double quotation mark is rendered asU+201D, RIGHT DOUBLE QUOTATION MARK. - Latin β the opening double quotation mark is rendered as
U+201C, LEFT DOUBLE QUOTATION MARK. the closing double quotation mark is rendered asU+201D, RIGHT DOUBLE QUOTATION MARK.
single quotes are specified explicitly, no alternating magic:
- for Latin and Hebrew, they're specified with a grave accent (
U+0060) for an opening single quote and an apostrophe (U+0027) for a closing single quote. - for Greek and Coptic, they're specified with a
"<"for an opening single quote and a">"for a closing single quote.
the use of "<" and ">" for Greek and Coptic was a compromise so that an ASCII apostrophe in Greek mode would render as U+02BC, MODIFIER LETTER APOSTROPHE. and as with double quotation marks, the rendering of these characters is dependent on the language mode.
single quotation marks are converted as follows:
- Greek, Coptic β the opening single quotation mark is rendered as
U+2039, SINGLE LEFT-POINTING ANGLE QUOTATION MARK. the closing single quotation mark is rendered asU+203A, SINGLE RIGHT-POINTING ANGLE QUOTATION MARK. - Hebrew β the opening single quotation mark is rendered as
U+201A, SINGLE LOW-9 QUOTATION MARK. the closing single quotation mark is rendered asU+2018, LEFT SINGLE QUOTATION MARK. - Latin β the opening single quotation mark is rendered as
U+2018, LEFT SINGLE QUOTATION MARK. the closing single quotation mark is rendered asU+2019, RIGHT SINGLE QUOTATION MARK.
β¨ EXTENSIONS FOR ASCII AND UNICODE β¨
the unibetacode package includes two extensions to TLG Beta Code:
- one for efficiently inserting an ASCII string into text when not in Latin mode
- and the other for inserting a Unicode code point in any language mode
these are described in the following two sub-sections. π
π§ ASCII STRING INSERTION π§
an ASCII string can be enclosed in curly brackets when in a non-Latin language mode. the string will be output verbatim. this can be useful if a Greek text uses ASCII symbols β say you want to produce a Greek document with an ASCII colon (':') rather than a Unicode "GREEK ANO TELEIA" character, U+0387. valid, we love options. π«Ά
the format is as follows:
{ASCII-string}
this is an extension to standard Beta Code; the TLG specification assigns a different use to'{'. by itself, the use of'{'not followed by a decimal number is deprecated in the TLG specification, so this should avoid some conflict. curly brackets are not allowed in the string. π
π¦ SPECIAL UNICODE CHARACTER INSERTION π¦
the original Beta Code specification lists many numeric codes for producing special symbols that today have become part of The Unicode Standard. in the future, it will likely be most beneficial if any specialized numeric codes for characters use Unicode code points rather than the historical TLG Beta Code numeric assignments. glow-up, honestly. β¨
the unibetacode package allows any Unicode code point to be specified in hexadecimal (which is how The Unicode Standard provides them) as a string inside an ASCII '{'...'}' escape sequence. the Unicode hexadecimal code point of one to six digits is preceded by "\u", taking the form "\ux...x". for example, strings such as
{\u3d8} or {\u3D8} or {\u03D8}
can be used to insert the Unicode character U+03D8, GREEK LETTER ARCHAIC KOPPA, which does not have an associated Beta Code letter assignment. it's giving orphan glyph, and we're adopting it. π₯Ή
such Unicode code point strings can be mixed with other characters in the same string, as long as any character that follows the Unicode code point is not a hexadecimal digit of '0'-'9', 'A'-'F', or 'a'-'f'. read that twice bestie, it matters. π
π NUMERIC DIGITS π
the numeric digits '0' through '9' are simply entered as '0' through '9', respectively, in any language mode. no tricks, no codes, just... numbers. refreshing honestly.
the language modes are Coptic, Greek, Hebrew, and Latin. they are described in the following sections. π
to be continued, bestie β the language modes are coming up next and they are a lot π
π GREEK π
Ok bestie, this is the main event, the moment we've all been waiting for. π
β¨ LETTERS β¨
So here's the tea: capital and small letters can take the exact same set of accent marks, but the order you write them in is different depending on which one you want. Lowkey iconic.
Small letters get written in Beta Code in this order: (1) letter, (2) breathing marks, (3) accents, and (4) iota subscript. Why? Because that's how small polytonic Greek letters traditionally look when typed β breathing marks first, then accent marks, sitting on top of the small letter, and iota subscripts chilling underneath the small long vowels. β¨
Capital letters get written in this order: (1) asterisk (which is the "this is a Capital letter" flag, fr), (2) breathing marks, (3) accents, (4) letter, and (5) iota subscript. Same energy, different layout β capital polytonic Greek letters traditionally put breathing marks and then accents to the left of the capital letter, and iota subscripts to the right of capital long vowels. π
Here's the letter mapping, in Greek alphabetical order. Letters can be capital or small; generally speaking small is easier to read, so small is the default output from uni2beta(1):
*aoraβ Capital or Small Alpha, respectively*borbβ Capital or Small Beta, resp.*gorgβ Capital or Small Gamma, resp.*dordβ Capital or Small Delta, resp.*eoreβ Capital or Small Epsilon, resp.*zorzβ Capital or Small Zeta, resp.*horhβ Capital or Small Eta, resp.*qorqβ Capital or Small Theta, resp.*ioriβ Capital or Small Iota, resp.*korkβ Capital or Small Kappa, resp.*lorlβ Capital or Small Lambda, resp.*mormβ Capital or Small Mu, resp.*nornβ Capital or Small Nu, resp.*corcβ Capital or Small Xi, resp.*ooroβ Capital or Small Omicron, resp.*porpβ Capital or Small Pi, resp.*rorrβ Capital or Small Rho, resp.*sorsβ Capital or Small Sigma, resp. π Note: a smallsgets interpreted as middle (medial) sigma or final sigma depending on the context. Wanna force one or the other? See the next two entries, bestie.s1β Small Middle (Medial) Sigmas2orjβ Small Final Sigma*s3ors3β Capital or Small Lunate Sigma, resp.*tortβ Capital or Small Tau, resp.*uoruβ Capital or Small Upsilon, resp.*forfβ Capital or Small Phi, resp.*xorxβ Capital or Small Chi, resp.*yoryβ Capital or Small Psi, resp.*worwβ Capital or Small Omega, resp.*vorvβ Capital or Small Digamma, resp.
Example moment π«Ά: "*to fws" means "the light" (no accent marks). You could also write it "*TO FWS" β capital and small letters give you the same conversion into UTF-8. No cap.
π BREATHING MARKS AND ACCENTS π
These are the encodings for breathing marks and accents. In Beta Code (just like in written Greek), breathing marks come before accents. The way that it's ordered... it's giving tradition. π
)β Smooth Breathing(β Rough Breathing\β Grave accent/β Acute accent=β Circumflex+β Diaresis&β MacronΒ΄β Breve?β Combining Dot Below
Example time β¨: "*to\ fw=s" is "the light", with a grave accent (or varia) over the omicron and a circumflex accent (or perispomeni) over the omega. You could also write it "*TO\ FW=S".
N.B.: the case of the Latin letter does not matter for accent placement β it's only the case of the Greek letter that matters. Greek capital letters are encoded with a preceding asterisk, so in this example"O\"and"W="will show up as small UTF-8. π
π¦ IOTA SUBSCRIPT π¦
The iota subscript is the last character written after a long vowel that it appears with β doesn't matter if the letter is capital or small, bestie. It's denoted by a vertical bar:
|β Iota subscript
π GREEK PUNCTUATION π
These are the punctuation symbols the unibetacode package supports:
.β Period (Teleia),β Comma:β Middle Dot (Ano Teleia);β Question Mark (Epotematiko)Β΄β Apostrophe (Apostrophos)-(hyphen) β Hyphen (Pavla)_(underscore) β Em Dash#β Greek Number Sign
π UNICODE GREEK π
So the Greek Extended range of The Unicode Standard, U+1F00 - U+1FFF, contains 16 small and capital vowels that have an identical representation in the Greek and Coptic range, U+0370 - U+03FF. These are vowels with an "oxia" (acute) accent in the Greek Extended range; they have equivalent glyphs with a "tonos" (acute) accent in the Greek and Coptic range. Because of this duplication, using these 16 Greek Extended glyphs is deprecated. π
uni2beta(1) will convert those 16 characters to Beta Code, but beta2uni(1) will convert the resulting Beta Code into characters in the Greek and Coptic range (U+0370 - U+03FF) β it will not convert them back into Greek Extended glyphs. The default settings in the libunibetacode library is to employ these 16 deprecated Unicode code points, but that can be modified; see the libunibetacode(3) man page for details. β¨
Also in the Greek Extended Unicode range: the TLG Project considers U+1FBF to be the equivalent of a smooth breathing mark, and uni2beta(1) will convert it as such.
β LATIN (ASCII) β
To display ASCII characters β including the Latin letters 'A' through 'Z' and 'a' through 'z' β start with an ampersand ('&') character. Then switch back to Greek mode with a dollar sign ('$') character. Simple as that. π
You can also surround ASCII characters with curly brackets, like "{Here is some ASCII!}". This is non-standard though β the TLG specification uses '&' and '$' to enter Latin and then switch back to Greek.
For efficiency, beta2uni(1) is conditioned to interpret sequences that look like accented Greek as accented Greek. Curly brackets are also useful for overriding those interpretations. For example, if a document contained the text
...(this is an example)
then the "e)" could get interpreted as a small epsilon with a smooth breathing mark above it. π To break this behavior, type
...(this is an example{}) or ...(this is an example{)}
and the Unicode output from beta2uni(1) will appear as intended. TeX users will find this technique very familiar, iykyk. π«Ά
πΈ COPTIC πΈ
To display Coptic letters, begin with the character sequence "&100". Switch back to Greek mode with a dollar sign ('$') character. And just like with Greek Beta Code, capital Coptic letters in Beta Code begin with an asterisk ('*') and small Coptic letters don't. β¨
Heads up bestie: unlike in Greek mode, the Coptic Beta Code letters are case-sensitive. In general, Coptic letters derived from Demotic use lowercase Beta Codes and map to the Greek and Coptic Unicode script in the rangeU+03E2-U+03EF; the rest of the Coptic letters use uppercase Beta Codes and map to the separate Coptic Unicode script in the rangeU+2C80-U+2C8D.
The encoding is as follows:
*AorAβ Capital or Small Alfa, respectively*BorBβ Capital or Small Vida, resp.*GorGβ Capital or Small Gamma, resp.*DorDβ Capital or Small Dalda, resp.*EorEβ Capital or Small Eie, resp.*VorVβ Capital or Small Sou, resp.*ZorZβ Capital or Small Zata, resp.*HorHβ Capital or Small Hate, resp.*QorQβ Capital or Small Tethe, resp.*IorIβ Capital or Small Iauda, resp.*KorKβ Capital or Small Kapa, resp.*LorLβ Capital or Small Laula, resp.*MorMβ Capital or Small Mi, resp.*NorNβ Capital or Small Ni, resp.*CorCβ Capital or Small Ksi, resp.*OorOβ Capital or Small O, resp.*PorPβ Capital or Small Pi, resp.*RorRβ Capital or Small Ro, resp.*SorSβ Capital or Small Sima, resp.*TorTβ Capital or Small Tau, resp.*UorUβ Capital or Small Ua, resp.*ForFβ Capital or Small Fi, resp.*XorXβ Capital or Small Khi, resp.*YorYβ Capital or Small Psi, resp.*WorWβ Capital or Small Oou, resp.*sorsβ Capital or Small Shei, resp.*forfβ Capital or Small Fei, resp.*korkβ Capital or Small Khei, resp.*horhβ Capital or Small Hori, resp.*jorjβ Capital or Small Gangia, resp.*gorgβ Capital or Small Shima, resp.*tortβ Capital or Small Dei, resp.\β Jinma (Grave) Accent
Switch back to Greek mode by ending with a dollar sign ('$') character. π
π§ HEBREW π§
The TLG specification only covers the basic Hebrew letters aleph through tav. These letters map to the Hebrew Unicode script in the range U+05D0 - U+05EA. Beta Codes are not defined in the specification for cantillation marks, Yiddish digraphs, etc. (sorry bestie π)
To display Hebrew letters, begin with the character sequence "&300".
Note: unlike in Greek mode, the Hebrew Beta Codes are case-sensitive and they never begin with an asterisk ('*').
The encoding is as follows:
Aβ Alefbβ Betgβ Gimeldβ Dalethβ Hevβ Vavzβ ZayinHβ HetQβ Tetyβ Yodk1β Middle Kafk2β Final Kaflβ Lamedm1β Middle Memm2β Final Memn1β Middle Nunn2β Final NunSβ Samekhaβ Ayinp1β Middle Pep2β Final PeT1β Middle TsadiT2β Final Tsadiqβ Qofrβ Reshsβ Shintβ Tav
Switch back to Greek mode with a dollar sign ('$') character. π«Ά
β¨ SAMPLES β¨
The directory "examples" in the source distribution contains samples with mappings from Beta Code to UTF-8 and vice versa. The "genesis-1-1.beta" and "genesis-1-1.utf8" files show the verse Genesis 1:1 in Koine Greek (from the Septuagint), Hebrew, and Bohairic Coptic in Beta Code and UTF-8, respectively. It's giving multilingual main character energy fr fr. π
π SEE ALSO π
unibetaprep(1), beta2uni(1), uni2beta(1), libunibetacode(3)
π AUTHOR π
The unibetacode package was created by Paul Hardy. π
π LICENSE π
The unibetacode package is Copyright Β© 2018, 2019, 2020 Paul Hardy. π
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. π«Ά
okay so bestie, "or any later version" is literally you getting to choose, it's giving options, it's giving freedom. slay. β¨
π BUGS π
ngl the format is very straightforward and no known bugs exist. π iconic behaviour honestly, we love a clean spec.
But. Okay. Here's the tea. β Beta Code has been evolving for almost 50 years, especially since the advent of Unicode. π So as a result, many Beta Code-encoded documents exist in versions of the standard much older than the current version β like, they're out here living in the past and we have to deal with that. π
This version also does not implement many numbered codes that are contained in the TLG Beta Code specification. π
And there are no plans to support the TLG Beta Code formatting codes, as that is beyond the scope of Unicode. periodt. π
bestie this is not a "we'll fix it later" situation, it's a "that's literally out of scope by design" situation. no cap. π
and that's the whole page, bestie!! go forth and encode ur Greek, Latin, Coptic and Hebrew with main character energy β¨πππ¦πΈ
this was the unibetacode(5) manual page, source/version UNIBETACODE(5), dated 2019 Jan 26 β written by Paul Hardy and lovingly over-explained by ur fave π take care of her, she's doing the lord's work fr fr π«Άπ
π¦ where this page comes from
- debian trixie: unibetacode 2.3-5 Β· GPL-2.0-or-later
- ubuntu questing: unibetacode 2.3-5
- ubuntu resolute: unibetacode 2.3-5build1 Β· GPL-2.0-or-later
- ubuntu stonking: unibetacode 2.3-5build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms