ZXing.PDF417.Internal.PDF417HighLevelEncoder.getEncoder(System.Text.Encoding)

Here are the examples of the csharp api class ZXing.PDF417.Internal.PDF417HighLevelEncoder.getEncoder(System.Text.Encoding) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

Project: ZXing.Net
Source File: PDF417HighLevelEncoder.cs
View license
private static byte[] toBytes(String msg, Encoding encoding)
      {
         return getEncoder(encoding).GetBytes(msg);
      }

2. Example

Project: ZXing.Net
Source File: PDF417HighLevelEncoder.cs
View license
private static byte[] toBytes(char msg, Encoding encoding)
      {
         return getEncoder(encoding).GetBytes(new []{msg});
      }

3. Example

Project: ZXing.Net
Source File: PDF417HighLevelEncoder.cs
View license
private static int determineConsecutiveBinaryCount(String msg, byte[] bytes, int startpos, Encoding encoding)
      {
         int len = msg.Length;
         int idx = startpos;
         int idxb = idx;  // bytes index (may differ from idx for utf-8 and other unicode encodings)
         encoding = getEncoder(encoding);
         while (idx < len)
         {
            char ch = msg[idx];
            int numericCount = 0;

            while (numericCount < 13 && isDigit(ch))
            {
               numericCount++;
               //textCount++;
               int i = idx + numericCount;
               if (i >= len)
               {
                  break;
               }
               ch = msg[i];
            }
            if (numericCount >= 13)
            {
               return idx - startpos;
            }
            ch = msg[idx];
            // .Net fallback strategie: REPLACEMENT_CHARACTER 0x3F
            if (bytes[idxb] == 63 && ch != '?')
            {
               throw new WriterException("Non-encodable character detected: " + ch + " (Unicode: " + (int) ch + ')');
            }
            idx++;
            idxb++;
            if (toBytes(ch, encoding).Length > 1)  // for non-ascii symbols
                idxb++;
         }
         return idx - startpos;
      }