# Encoding Issues

The current vCard and iCalendar standards ([VCARD, ICAL]) suggest the use of UTF-8 ([UTF-8]) as default encoding for vCard and iCalendar files. Since UTF-8 is the only portable way to store internationalized files, it is used by default by Libmimedir when files are saved. On loading, an UTF-8 encoding is assumed, if the encoding is not settable in the loading function. (The various load_from_channel functions define the encoding implicitly through the channel's encoding.) If the input is not in UTF-8, a conversion error will be returned.

The two functions mimedir_vcard_read_list() and mimedir_vcal_read_list() are special cases; they open a file, first assuming it is in UTF-8 encoding. If the file contains invalid UTF-8 sequences, a second try is employed, using the current locale. If this fails, too, a third and final try is made, assuming the file is in ISO-8859-15 (aka ISO Latin 9) encoding.