【发布时间】:2020-09-18 12:28:43
【问题描述】:
我尝试使用“ä”等特殊字母创建 Aztec 条码。 我尝试激活 UTF-8,但条形码仍然只包含十六进制。 有人知道怎么回事吗?
var writer = new BarcodeWriter
{
Format = BarcodeFormat.AZTEC,
Options = new AztecEncodingOptions
{
Height = Height,
Width = Width,
}
};
//Hashtable hints = new Hashtable();
//writer.Options.Hints.Add(EncodeHintType.CHARACTER_SET, "utf-8");
//KeyValuePair<EncodeHintType, object> valuePair = new KeyValuePair<EncodeHintType, object>(EncodeHintType.CHARACTER_SET, "UTF-8");
//writer.Options.Hints.Add(valuePair);
writer.Options.Hints.Add(EncodeHintType.DISABLE_ECI, true);
writer.Options.Hints.Add(EncodeHintType.CHARACTER_SET, "UTF-8");
var bitmap = writer.Write(value);
Bitmap img = new Bitmap(bitmap);
谢谢!
【问题讨论】:
-
那是你代码中的
Encoding?不能是 System.Text.Encoding 类。 -
哦,是的。它是一个参数。我也试过“UTF-8”……我编辑了代码……
-
Aztec 编码的默认字符集 ISO8859-1 可以表示字符 ä。你为什么尝试 UTF-8?
-
第一次尝试没有使用 utf-8。字符 ä 未表示。
-
我不敢相信。我用 zxing.net 的 WinForm 演示应用程序尝试了你的内容,它没有任何问题。