mirror of https://github.com/gogits/gogs.git
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
573 B
24 lines
573 B
8 years ago
|
package qr
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/boombuler/barcode/utils"
|
||
|
)
|
||
|
|
||
|
func encodeAuto(content string, ecl ErrorCorrectionLevel) (*utils.BitList, *versionInfo, error) {
|
||
|
bits, vi, _ := Numeric.getEncoder()(content, ecl)
|
||
|
if bits != nil && vi != nil {
|
||
|
return bits, vi, nil
|
||
|
}
|
||
|
bits, vi, _ = AlphaNumeric.getEncoder()(content, ecl)
|
||
|
if bits != nil && vi != nil {
|
||
|
return bits, vi, nil
|
||
|
}
|
||
|
bits, vi, _ = Unicode.getEncoder()(content, ecl)
|
||
|
if bits != nil && vi != nil {
|
||
|
return bits, vi, nil
|
||
|
}
|
||
|
return nil, nil, fmt.Errorf("No encoding found to encode \"%s\"", content)
|
||
|
}
|