How many alphanumeric charecters can be embedded in a QR Code? - character-encoding

As per the Wiki below
QRC Storage Data
the maximum number of alphanumeric charecters that can be stored is 4,296. But while trying it out, I'm unable to proceed for more than approx 2220 charecters at an error correction level of L.
Is alphanumeric charecters not the same numeric charecters. Do "123", "XYZ" and "AB%" not all contain "Three" charecters?

The max is 4296 if you are in alphanumeric mode. To do that you can only use the characters listed on the link you sent. Your examples are certainly all 3 characters, and fit the alphanumeric character set.
It is probably a problem with the encoder, or some other intermediate limitation, like the length of a URL you are sending to the encoder.

Related

How do I keep my rails integer from being converted to binary?

As you may be able to see in the image, I have a User model and #user.zip is stored as an integer for validation purposes (ie, so only digits are stored, etc.). I was troubleshooting an error when I discovered that my sample zip code (00100) was automatically being converted to binary, and ending up as the number 64.
Any ideas on how to keep this from happening? I am new to Rails, and it took me a few hours to figure out the cause of this error, as you might imagine :)
I can't imagine any other information would be helpful here, but please inform me if otherwise.
This is not binary, this is octal.
In Ruby, any number starting with 0 will be treated as an octal number. You should check the Ruby number literals to learn more about this, here's a quote:
You can use a special prefix to write numbers in decimal, hexadecimal, octal or binary formats. For decimal numbers use a prefix of 0d, for hexadecimal numbers use a prefix of 0x, for octal numbers use a prefix of 0 or 0o, for binary numbers use a prefix of 0b. The alphabetic component of the number is not case-sensitive.
For your case, you should not store zipcodes as numbers. Not only in the database, but even as variables don't treat them as numeric values. Instead, store and treat them as strings.
The zip should probably be stored as a string since you can't have a valid integer with leading zeroes.

Why do some characters have Escape character before them?

Some special characters like | , ~ , ^ , { , } and many others have Escape characters before them. Have a look at the screenshot or visit this link : http://messente.com/documentation/sms-length-calculator, to check it yourself.
I want to know as I don't understand why these characters have Escape characters before them or how/why these characters are different from other (special) characters.
See here for information about the GSM 03.38 encoding.
“Why” questions are always difficult to answer precisely, but my guess is that the goal is to be able to encode the characters deemed most common with 7 bits, while other, less frequent characters will require 14 bits.
There are only 1120 bits per SMS, so saving space is desirable. With the above encoding, you can get more than 140 characters encoded for a “normal” text message.

How to edit an IBAN number in four character groups?

https://en.wikipedia.org/wiki/International_Bank_Account_Number#Practicalities
The IBAN should not contain spaces when transmitted electronically:
when printed it is expressed in groups of four characters separated by
a single space, the last group being of variable length as shown in
the example below:
A typical IBAN looks like this: GR16 0110 1250 0000 0001 2300 695 (taken from the above link).
I want to make it easier for users to enter IBAN numbers. Currently I use a TDBEdit to display the IBAN number and it is stored as characters (without the spaces) in the database.
I know that it is possible to format numbers using TNumericField.DisplayFormat, also there is TMaskEdit, but both aren't terribly useful for this purpose as IBAN is not a number and has different lenghts in different countries.
How to edit an IBAN number in four character groups in a DB control?
PS: I'm not asking for the actual IBAN validation as I already have that figured out.
You can use the EditMask property of the IBAN field as this will also work for string fields. A suitable EditMask for IBAN may look like this:
">LL00 aaaa aaaa aaaa aaaa aaaa aaaa aaaa aa;0; "
The first character makes the edit field convert all characters to upper case. The next four entries require two alpha characters followed by two numeric ones. The blanks represent the requested gaps. The lower "a" allows an alphanumeric character but doesn't require it.
The "0" in the second part of the mask will strip any literals (the gap blanks) from the entry stored in the field.
The blank in the third part of the mask makes the gap blanks being displayed as blank.

How many chars can numeric EDIFACT data elements be long?

In EDIFACT there are numeric data elements, specified e.g. as format n..5 -- we want to store those fields in a database table (with alphanumeric fields, so we can check them). How long must the db-fields be, so we can for sure store every possible valid value? I know it's at least two additional chars (for decimal point (or comma or whatever) and possibly a leading minus sign).
We are building our tables after the UN/EDIFACT standard we use in our message, not the specific guide involved, so we want to be able to store everything matching that standard. But documentation on the numeric data elements isn't really straightforward (or at least I could not find that part).
Thanks for any help
I finally found the information on the UNECE web site in the documentation on UN/EDIFACT rules Part 4. UN/EDIFACT rules Chapter 2.2 Syntax Rules . They don't say it directly, but when you put all the parts together, you get it. See TOC-entry 10: REPRESENTATION OF NUMERIC DATA ELEMENT VALUES.
Here's what it basically says:
10.1: Decimal Mark
Decimal mark must be transmitted (if needed) as specified in UNA (comma or point, put always one character). It shall not be counted as a character of the value when computing the maximum field length of a data element.
10.2: Triad Seperator
Triad separators shall not be used in interchange.
10.3: Sign
[...] If a value is to be indicated to be negative, it shall in transmission be immediately preceded by a minus sign e.g. -112. The minus sign shall not be counted as a character of the value when computing the maximum field length of a data element. However, allowance has to be made for the character in transmission and reception.
To put it together:
Other than the digits themselves there are only two (optional) chars allowed in a numeric field: the decimal seperator and a minus sign (no blanks are permitted in between any of the characters). These two extra chars are not counted against the maximum length of the value in the field.
So the maximum number of characters in a numeric field is the maximal length of the numeric field plus 2. If you want your database to be able to store every syntactically correct value transmitted in a field specified as n..17, your column would have to be 19 chars long (something like varchar(19)). Every EDIFACT-message that has a value longer than 19 chars in a field specified as n..17 does not need to be stored in the DB for semantic checking, because it is already syntactically wrong and can be rejected.
I used EDI Notepad from Liaison to solve a similar challenge. https://liaison.com/products/integrate/edi/edi-notepad
I recommend anyone looking at EDI to at least get their free (express) version of EDI Notepad.
The "high end" version (EDI Notepad Productivity Suite) of their product comes with a "Dictionary Viewer" tool that you can export the min / max lengths of the elements, as well as type. You can export the document to HTML from the Viewer tool. It would also handle ANSI X12 too.

HuffmanCode fixed bits length per character

How do you determine how many bits per character are required for a fixed length code in a string using huffman? i had an idea that you count the number of different characters in a string than you present that number in binary so that will be the fixed length but it doesn't work. For example in the string "letty lotto likes lots of lolly"...there are 10 different characters excluding the quotes(since 10 = 0101(4bits), i thought it meant all the characters can be represented using 4 bits), now the frequency of f is 1 and is encoded as 11111(5 bits)not 4.
Let's say you have a string with 50 "A"s, 35 "B"s and 15 "C"s.
With a fixed-length encoding, you could represent each character in that string using 2 bits. There are 100 total characters, so when using this method, the compressed string would be 200 bits long.
Alternatively, you could use a variable-length encoding scheme. If you allow the characters to have a variable number of bits, you could represent "A" with 1 bit ("0"), "B" with 2 bits ("10") and "C" with 2 bits ("11"). With this method, the compressed string is 150 bits long, because the most common pieces of information in the string take fewer bits to represent.
Huffman coding specifically refers to a method of building a variable-length encoding scheme, using the number of occurrences of each character to do so.
The fixed-length algorithm you're describing is entirely separate from Huffman coding. If your goal is to compress text using a fixed-length code, then your method of figuring out how many bits to represent each character with will work.

Resources