Closed jorol closed 10 years ago
UTF-8 is fine but other encoding must also be known to the XML writer to emit character entities of characters not expressible in an encoding. Can be define a list of supported encodings?
'UTF-8' was only an example for my preferred syntax of the argument. Do we need a list? Couldn´t we just check if the encoding is installed and then set the binmode? See https://github.com/jorol/Catmandu-MAB2/blob/devel/lib/MAB2/Writer/Handle.pm
Sorry, I misread your comment... I think the user has to take care, that all characters could be map to other encodings than UTF-8. IO will throw a warning if a character can´t be mapped to the chosen encoding.
This should better be solved in Catmandu::Exporter instead of overriding its method encoding
, file
, and fh
.
Ok, I will open an issue.
Script:
Warning:
We should distinguish XML attribute "encoding" (like 'UTF-8') and binmode "encoding" layer (like ':encoding(UTF-8)'). I would prefer the usage of 'UTF-8', 'ISO-8859-1' as argument. The binmode "encoding" layer could be constructed from that. Perhaps this should also be discussed for Catmandu::Exporter.