how to display thai in .rb

  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.
  • warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1005 is not allowed to access /tmp owned by uid 0 in /var/www/sites/sugree/codenone.com/subdomains/www/html/includes/file.inc on line 190.

อยากทราบวิธีการใช้ภาษาไทยกับ .rb
ตอนนี้ทดสอบกับ .rthml หรือการดึงจาก database ก็ไม่มีปัญหาครับ
แต่ติดที่ .rb ไม่สามารถแสดงภาษาไทยได้ พอมีใครรู้วิธีไหมครับ

veer's picture

print ออก terminal?

theink's picture

ออกเว็บสิครับ
คือใน .rb เราจะสามารถพิมพ์ไทยลงไปได้ใช้ไหมครับ
แต่มันแสดงออกมาไม่ได้ มันจะ error ยกตัวอย่างเช่นการสร้าง .rb ใน helper
พอรู้ไหมครับว่าต้องทำอย่างไร

keng's picture

puts "ภาษาไทยนะจ๊ะ"

#=> ภาษาไทยนะจ๊ะ

?

ผมทดลอง

module HomeHelper
  def test_helper
    'hi ภาษาไทย'
  end
end

แล้วใช้แบบนี้ใน rhtml
<%= test_helper %>
ก็ได้ผลถูกต้องดีนะ

sugree's picture

เดาว่า editor แหง

theink's picture

เศร้าครับ T_T
สุดท้าย พบว่าแค่ encode เป็น UTF-8 without BOM เหมือนตอนทำ .rhtml ก็จบ
ขอบคุณ taiko ครับ

อ้อนี่เว็บไซต์ที่ทำด้วย RoR ครับ http://www.wish.in.th
กำลังพัฒนาให้เป็น Social Networking website ดีๆ เพื่อคนไทย
ภาษาไทยเลยจำเป็นอย่างยิ่ง ;)

ย้าย Codenone

ประกาศย้าย Codenone ไปใช้ Forum ของ Blognone แทนครับ ตามไปตั้งกระทู้ต่อได้ที่ Codenone Forum (รายละเอียดอ่านจากกระทู้ ย้าย Codenone ไปรวมกับ Blognone)

กระทู้เก่าๆ จะย้ายตามไปในภายหลัง ตอนนี้ปิดการโพสต์กระทู้ไว้ เหลือไว้เฉพาะอ้างอิงเท่านั้น