alexeyten / qr-image

Yet another QR code generator
MIT License
1.05k stars 168 forks source link

can I encode newline #33

Closed academyofzhuang closed 8 years ago

academyofzhuang commented 8 years ago

Input text "a\nb". Encoding "utf-8"

Using a QR code reader to scan the output svg, consecutive newlines are squeezed to a single space char.

What can I do?

academyofzhuang commented 8 years ago

This is a QR code reader issue. It has nothing to do with qr-image module!

Newline are encoded but not properly decoded by a reader, namely WeChat!

To make WeChat properly display newlines, two solutions:

  1. prepend a Chinese character at the beginning of the mesaage: var text = "识别的内容是\n\n" + text;
  2. input text as GB2312. Here is an utf8 to gb2312 converter https://gist.github.com/fwolf/b2433ecd482c561cb3bd .

Damn weChat!