-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIN-1255 Encoding for Type 2 Fields #32
Comments
Hi @Doreen-Schwartz, this is an interesting subject. A question: how the charset encoding is conveyed between the NIST file producer and the NIST file consumer? Is there a special field in the NIST file? Or just by convention? That would somehow influence the futher discussion. I don't want to tie
|
As far as I have seen, there is no specific field that the consumer takes into consideration. We have an existing producer that creates NIST files which the consumer does successfully read, and I didn't notice any fields that provided this information- not in the file or the documentation for the consumer. So it is just a convention for this specific consumer. Just to give some context, when I tried uploading a NIST produced using the As for the potential changes, I was thinking I could add callbacks for the Something like this, maybe: /** Encoding options for a single NIST Field. */
interface NistFieldEncodeOptions extends NistFieldCodecOptions {
formatter?: (field: NistField, nist: NistFile) => NistFieldValue;
informationWriter?: (informationItem: NistInformationItem, data: EncodeTracking) => EncodeTracking;
} Which would then be used in place data.buf.write in |
Another thing I noted is that there is usage of the |
For decoding logic, the proposed interface enhancement looks good, such as: /** Decoding options for a single NIST Field. */
export interface NistFieldDecodeOptions extends NistFieldCodecOptions {
parser?: (field: NistField, nist: NistFile) => Result<NistFieldValue, NistParseError>;
informationDecoder?: (buffer: Buffer, startOffset: number, endOffset: number): string;
} For encoding logic, consider that the the Performance-wise, I'd say a charset conversion process is computationally comparable to |
@Doreen-Schwartz I've finished updating the documentation. Please check 8473957. |
@ivosh Overall looks great! Only one thing I noticed is that in the JSDoc for Otherwise seems to cover things well 👍 |
@Doreen-Schwartz Thank you for the review. I am always glad to have another pair of eyeballs ;-) |
Hello, I understood that currently, the only supported encoding for fields that are not Type 1 is UTF-8. I was wondering if there are any intentions to add support for additional encoding?
If not, I would love to try implementing this myself. Would appreciate getting pointers to how to implement this- which parts of the encoding process would require adjusting to enable this functionality?
From what I've gathered, the default Node Buffer currently used to construct the NIST file only supports very specific types of encoding. Looking at possible alternatives, iconv-lite seems like a decent package to utilize for this.
@JonathanZahavii
The text was updated successfully, but these errors were encountered: