Comments (7)
Got it, thank you so much for the library and for the information!)
from epc-tds.
Hello Dmitry,
The EAN codes you are using have the wrong control code. For example, the ean 0000007401802(4) has 4 as check digit.
Greetings.
from epc-tds.
I checked all the above eans here https://www.gs1.ch/en/home/offer/barcode/check-digit-calculator-and-ean-13-barcode-generator and yes all of them have the wrong check digit. Thank you so much for pointing it out!)
from epc-tds.
Hi Dmitry,
Thanks for your input.
GS1 documentation indicates that a GTIN must have 14 digits, so the user must fill in with leading zeros.
Try this:
console.log('eanToEpc -> epcToEan:', epcToEan(eanToEpc('00000060573421')));
Or modify your eanToEpc method, like this:
const eanToEpc = (ean: string): string => {
const epc = new tds.Sgtin96().setGtin(ean.padStart(14,"0"));
return epc.toHexString();
}
You can also use this GS1 web app to perform checks:
https://www.gs1.org/services/epc-encoderdecoder
Best regards.
Sergi
from epc-tds.
Aha, and then when I receive a result from RFID device (which is EPC) and extract EAN from it, I can safely remove all leading zeros from this EAN?
from epc-tds.
Yes, you can remove them, but if you want to use a standard later (GTIN-8, GTIN-12, GTIN-14), you will have to control the number of digits.
from epc-tds.
Hello,
I use the same logic ean -> epc -> ean and seems like there is something wrong with some ean numbers:
original ean: 00000074018029. decoded ean: 00000074018024. epc: 30000001C3C5280000000000
original ean: 00000045214445. decoded ean: 00000045214448. epc: 3000000113F7900000000000
original ean: 00000028225773. decoded ean: 00000028225775. epc: 30000000AC46C40000000000
The last digit in decoded ean differs from the original ean number.
What could be the reason for such behavior?
from epc-tds.
Related Issues (5)
- Typescript support HOT 1
- Browser support HOT 4
- Unsupported EPC HOT 1
- Invalid results with values larger than MAX_SAFE_INTEGER HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epc-tds.