Skip to content
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

Add support for initial FNC1 char in a GS1-C128 barcode #206

Conversation

nranopter
Copy link

@nranopter nranopter commented Jun 4, 2024

In current version if you try to add a GS1-C128 barcode with an initial FNC1 char and using dynamic C128 you will get the following error:

"System.Exception: EC128-3: Could not insert start and code characters.
Message: EC128-2: Could not determine start character."

This fix allows the FNC1 char to be added to the start of the barcode.

@@ -172,6 +172,7 @@ void entry(string a, string b, string c, string encoding)
entry("CODE_B", "FNC4", "CODE_B", "10111101110");
entry("FNC4", "CODE_A", "CODE_A", "11101011110");
entry("FNC1", "FNC1", "FNC1", "11110101110");
entry($"{FNC1}", $"{FNC1}", $"{FNC1}", "11110101110");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but doesnt it look at each char and look it up in the dictionary? I think the parsing of the data to encode might have to be adjusted to just look for FNC1 or such instead of adding this?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im going off memory so bare with me :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this change before summer so my memory is a bit fuzzy. But I think that changing the parsing of the data would be a bigger change. This is just to make sure that the FNC1 character is replaced with the proper code.

And it doesn't feel that the parsing really need to be changed, it's just that the FNC1 char wasn't recognized as it wasn't in the entries. But that is just my take on it, it could be that I am missing something :)

I updated the test to prove what we are trying to do. So you can try and revert the entry and run the test to see the issue I'm trying to solve.

@nranopter
Copy link
Author

Resolves #179

@nranopter
Copy link
Author

Merged my branch with master and fixed tests that is failing.

New take is to replace the FNC1 char with FNC1 codeword instead. Seems to work better.

@nranopter nranopter closed this Sep 17, 2024
@nranopter
Copy link
Author

After testing realized that FNC1 wasn't properly added on a dynamic barcode. Will update this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants