.TH "autotoc_md280" 3elektra "Sun Nov 15 2020" "Version 0.9.3" "Elektra" \" -*- nroff -*- .ad l .nh .SH NAME autotoc_md280Plugin: iconv \- .IP "\(bu" 2 infos = Information about iconv plugin is in keys below .IP "\(bu" 2 infos/author = Markus Raab elektra@libelektra.org .IP "\(bu" 2 infos/licence = BSD .IP "\(bu" 2 infos/provides = conv .IP "\(bu" 2 infos/needs = .IP "\(bu" 2 infos/placements = postgetstorage presetstorage .IP "\(bu" 2 infos/status = maintained unittest libc .IP "\(bu" 2 infos/description = Converts values of keys between charsets .PP .PP This plugin is a filter plugin that converts between different character encodings\&. .PP Consider a user insisting on a \fClatin1\fP character encoding because of some old application\&. All other users already use, for example, \fCUTF-8\fP\&. For these users, the configuration files are encoded in \fCUTF-8\fP\&. So we need a solution for the user with \fClatin1\fP to access the key database with proper encoding\&. .PP On the other hand, contemplate an XML file which requires a specific encoding\&. But the other key databases work well with the users encoding\&. So a quick fix for that backend is needed to feed that XML file with a different encoding\&. .PP The iconv plugin provides a solution for both scenarios\&. It converts between many available character encodings\&. With the plugin’s configuration the user can change the from and to encoding\&. The default values of the plugin configuration are: \fCfrom\fP encoding will be determined at run-time\&. \fCto\fP encoding is \fCUTF-8\fP\&. .PP Parameters: .PP .IP "\(bu" 2 \fCto\fP is per default UTF-8, to have unicode configuration files .IP "\(bu" 2 \fCfrom\fP is per default the users locale .PP .PP Note that for writing the configuration \fCfrom\fP and \fCto\fP is swapped\&. A key database that requires a specific encoding can make use of it\&. To sum up, every user can select a different encoding, but the key databases are still properly encoded for anyone\&. .PP For example \fCiconv/iconv\&.ini\fP should be \fClatin1\fP, but all users have \fCUTF-8\fP settings: .PP ``\fC @section autotoc_md283 Mount the file\fPiconv/iconv\&.ini\fCusing the\fPmini\fCplugin together with\fPiconv` sudo kdb mount '$PWD/src/plugins/iconv/iconv/iconv\&.ini' system/tests/iconv mini iconv from=UTF-8,to=ISO-8859-1 .SH "Check the file type of the mounted file" .PP file -b '`kdb file system/tests/iconv`' #> ISO-8859 text .PP kdb get system/tests/iconv/a # converts ISO-8859 to UTF-8 #> hellö .PP kdb set system/tests/iconv/a öäß # converts UTF-8 to ISO-8859 kdb get system/tests/iconv/a #> öäß .SH "Cleanup" .PP kdb set system/tests/iconv/a hellö sudo kdb umount system/tests/iconv ```