Cz::Cstocs(3pm)
π Cz::Cstocs β bestie, it's the charset glow-up page π
okay so you found the Cz::Cstocs(3pm) manual page and honestly? it's giving "User Contributed Perl Documentation" realness. this is the module that converts text between all the charset encodings used for Czech and Slovak, and i'm gonna walk you through it like we're texting at 2am. no gatekeeping. periodt. π
β¨ NAME β¨
Cz::Cstocs β conversions of charset encodings for the Czech language π¦
πΈ SYNOPSIS πΈ
here's the vibe, three whole ways to do the thing:
use Cz::Cstocs;
my $il2_to_ascii = new Cz::Cstocs 'il2', 'ascii';
while (<>) {
print &$il2_to_ascii($_);
}
use Cz::Cstocs 'il2_ascii';
while (<>) {
print il2_ascii($_);
}
use Cz::Cstocs;
sub il2toascii;
# inform the parser that there is a function il2toascii
*il2toascii = new Cz::Cstocs 'il2', 'ascii';
# now define the function
print il2toascii $data;
# thanks to Jan Krynicky for poining this out
like. three flavours, one obsession. π
π DESCRIPTION π
so this module's whole job is helping you convert texts between the various charset encodings used for Czech and Slovak. iconic behaviour honestly.
you make your instance of the Cz::Cstocs object with method new. it takes at least two parameters β input encoding and output encoding β and after that you can use it as a function reference to convert strings and lists. π
and the way Cz::Cstocs handles aliases is so chill, it's fairly free form, so all of these:
iso8859-2ISO-8859-2iso88592il2
are literally aliases of the same encoding. same girl, different outfits. π
for backward compatibility, method conv is supported too, so the example up there could also read:
while (<>) {
print $il2_to_ascii->conv($_);
}
you can also use typeglob syntax. yes bestie, that too. β¨
the conversion function takes a list and returns a list of converted strings (in list context) or one string consisting of concatenated results (in scalar context). know the difference, it matters. π
π options (you can tweak the vibe) π
you can modify the behaviour of the conversion function by specifying a hash of other options after the encoding names in the call to new. let's go through them one by one, no skipping:
fillstringβ gives an alternate string that will replace characters from the input encoding that are not present in the output encoding. the default is a space.use_accentβ defines whether the accent file should be used. default is1(true). βnofillstringβ when1(true), it will keep characters that do not have friends in the accent nor the output encoding, and will not replace them withfillstring. default is0, except fortex, because honestly you probably rather want to keep backslashed symbols than lose them. π«Άcstocsdirβ alternate location for the encoding and accent files. the default is theCz/Cstocs/encdirectory in the Perl library tree. this location can also be changed with theCSTOCSDIRenvironment variable. πΈ
π§ the alternate way to define the function π§
there's another way to define the conversion function, and it's lowkey elegant: any arguments after use Cz::Cstocs that have the form encoding_encoding or encoding_to_encoding are processed, and the appropriate functions get imported. so:
use Cz::Cstocs qw(pc2_to_il2 il2_ascii);
defines two functions that are loaded into the caller's namespace and can be used directly. π
β οΈ but heads up bestie: in this case you cannot specify additional options. you only get the default behaviour. that's the trade-off. π
π¨ ERROR HANDLING π¨
if you request an unknown encoding in the call to new Cz::Cstocs, the conversion object is not defined, and the variable $Cz::Cstocs::errstr is set to the error message. so go read $Cz::Cstocs::errstr, it's trying to tell you something. π
but when you specify an unknown encoding in the use call style (like "use Cz::Cstocs 'il2_ascii';"), then die is called. dramatic? yes. effective? also yes. π
π AUTHOR π
- Jan Pazdziora created the module version.
- Jan "Yenya" Kasprzak has done the original Un*x implementation.
legends, both of them. π
β VERSION β
3.43
π SEE ALSO π
cstocs(1)perl(1)- or
Xcstocsathttp://www.lut.fi/~kurz/programs/xcstocs.tar.gz
and that's the whole page, bestie!! this was Cz::Cstocs(3pm) from perl v5.30.0, dated 2019-10-05 β shoutout to the User Contributed Perl Documentation era, we love her, mwah πβ¨π
π¦ where this page comes from
- ubuntu jammy: cstocs 1:3.44-1.1 Β· GPL-1.0-or-later OR Artistic-1
- ubuntu noble: cstocs 1:3.44-1.1 Β· GPL-1.0-or-later OR Artistic-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms