Preserve the language tag of the filename #21

Closed
opened 2015-12-22 12:05:29 +13:00 by mikedilger · 1 comment
mikedilger commented 2015-12-22 12:05:29 +13:00 (Migrated from github.com)

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.

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: ``` rust 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 commented 2023-09-30 06:55:29 +13:00 (Migrated from github.com)

Closing to to archival status

Closing to to archival status
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mikedilger/formdata#21
No description provided.