formdata icon indicating copy to clipboard operation
formdata copied to clipboard

Preserve the language tag of the filename

Open mikedilger opened this issue 9 years ago • 0 comments

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:

  1. The consumer may want to preserve the original filename encoding.
  2. 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.

mikedilger avatar Dec 21 '15 23:12 mikedilger