Open mkroening opened 1 year ago
I wonder if other crates treat custom structures defined by this crate (e.g. Cp437
) as the common u8
.
Also used code pages may be vary in response to options of programs or locales of users, so I think we have to provide APIs like <code page (table) structure>.{en,de}code_char_*
or {de,en}code_char_checked
.
I wonder if other crates treat custom structures defined by this crate (e.g.
Cp437
) as the commonu8
.
The inner u8
would still be accessible, and the representation is transparent, so it can be used in places where u8
was used before.
Also used code pages may be vary in response to options of programs or locales of users, so I think we have to provide APIs like
<code page (table) structure>.{en,de}code_char_*
or{de,en}code_char_checked
.
Yes, that sounds good.
I'll work on this after https://github.com/tats-u/rust-oem-cp/pull/9, but it might take a while. I am quite busy at the moment.
@mkroening Can and should we make CpXXX
struct
ures impl
ement a common trait
? If so can we switch CpXXX
struct
ures in response to other variables (arguments and locales for example)? Anyway I think {en,de}code_char_*
have higher priorities.
@mkroening Fixed in https://github.com/tats-u/rust-oem-cp/commit/c690b988bd69f9747d37fe4fc1c24fd4f051d3f3. I'd like you to try the master branch if possible. I'm planning to release v3.0.0 in the near future.
A
char
-base API can be used for easy conversion ofchars
, so one does not need to access the maps manually and perform the shift by128
and so on and so forth.I am thinking of an API like this:
This could be the base for the provided string-based API as well.
Would you be open to a PR?