text 传入英文正常,中文就扫描不出来或者扫出来的是乱码。 controller 和 view 代码片段:
# coding: utf-8
def print
require 'rqrcode'
text = "你好"
@qr = RQRCode::QRCode.new(text, :size =>10, :level => :h,:unit => 10,:offset=>10)
respond_to do |format|
format.html{render :layout=>false}
format.pdf{render :layout=>false}
end
end
<table class="fwimg" border="0" cellspacing="0" cellpadding="0">
<% @user2x do |x| %>
<tr>
<% @user3x do |y| %>
<% if @qr.dark?(x,y) %>
<td class="black"/>
<% else %>
<td class="white"/>
<% end %>
<% end %>
</tr>
<% end %>
</table>