formdata
formdata copied to clipboard
Preserve the language tag of the filename
Currently our filename is simply an Option<String>. A recent commit ensures any specified charset is taken into account and the string in that charset is decoded into utf-8. The language tag is discarded.
Two problems with this:
- The consumer may want to preserve the original filename encoding.
- We need to preserve the language tag, so we need to change our UploadedFile structure anyway.
So the Filename structure will look like:
pub struct Filename {
pub charset: Charset,
pub language_tag: Option<LanguageTag>,
pub bytes: Vec<u8>,
}
and we may want to implement functions which decode the bytes into utf-8 according to the charset as our current code does in charset_decode().
However, this work depends on LanguageTag implementing serde Serialize/Deserialize first, so our UploadedFile struct retains its ability to serialize/deserialize.