escpos
escpos copied to clipboard
Print currency and chars with accent
Hi, I don't understand how to print currency symbols, like €
, and chars with accent, like è
.
I'm trying this:
p.SetLang("it")
p.Write("èéà°òçù§£$€")
but all I get is scrambled text.
Thanks for your work!
Hi,Probably a charger issue. Did you try to send raw char for € in say ISO 8859-15 "\xa4"?Le 26 avr. 2018 00:23, Lorenzo Junior Ferrara [email protected] a écrit :Hi, I don't understand how to print currency symbols, like €, and chars with accent, like è. I'm trying this: p.SetLang("it") p.Write("èéà°òçù§£$€")
but all I get is scrambled text. Thanks for your work!
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.
You need to encode your characters to the desired format before calling 'p.Write'.
i.e.:
import "golang.org/x/text/encoding/charmap"
// omitted code ...
text := "èéà°òçù§£$€"
encoder := charmap.CodePage437.NewEncoder()
encoded, _ := encoder.String(text)
p.Write(encoded)
Go doc: https://godoc.org/golang.org/x/text/encoding/charmap Used code page: https://reference.epson-biz.com/modules/ref_charcode_en/