本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
573B

  1. package qr
  2. import (
  3. "fmt"
  4. "github.com/boombuler/barcode/utils"
  5. )
  6. func encodeAuto(content string, ecl ErrorCorrectionLevel) (*utils.BitList, *versionInfo, error) {
  7. bits, vi, _ := Numeric.getEncoder()(content, ecl)
  8. if bits != nil && vi != nil {
  9. return bits, vi, nil
  10. }
  11. bits, vi, _ = AlphaNumeric.getEncoder()(content, ecl)
  12. if bits != nil && vi != nil {
  13. return bits, vi, nil
  14. }
  15. bits, vi, _ = Unicode.getEncoder()(content, ecl)
  16. if bits != nil && vi != nil {
  17. return bits, vi, nil
  18. }
  19. return nil, nil, fmt.Errorf("No encoding found to encode \"%s\"", content)
  20. }
上海开阖软件有限公司 沪ICP备12045867号-1