Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6865599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:04:27+00:00 2026-05-27T03:04:27+00:00

I am running into encoding problems: db = SQLite3::Database.new encoding.db => #<SQLite3::Database:0x9b69cbc> db.encoding =>

  • 0

I am running into encoding problems:

db = SQLite3::Database.new "encoding.db"
=> #<SQLite3::Database:0x9b69cbc>

db.encoding
=> #<Encoding:UTF-16LE>

r1 = db.execute("select * from db_log_sink limit 2").first.last
=> "\u7953\u7473\u6D65\u5420\u6D69\u7A65\u6E6F\u3A65\u4520\u5453\u2F20\u4520\u5444\x0A"

r2 = db.execute("select * from db_log_sink limit 2").last.last
=> "????????\u0A3A"

r1.encoding
=> #<Encoding:UTF-16LE>

r2.encoding
=> #<Encoding:UTF-8>

Working at the linux command line with the same file I get:

select * from db_log_sink limit 2;
1|2011-11-16T12:02:15|0|System Timezone: EST / EDT
2|2011-11-16T12:02:15|0|Server Hostnames:

In the browser r2 comes out as Chinese traditional han. r1 comes out as normally formatted text.

About half the records in text columns come out garbled when using the gem/ruby. Everything looks normal at the Linux command line and using SQLiteSpy under Windows.

I have tried ~20 sqlite databases so far and they all show the same behaviour.

I can provide a download link for a db file if needed.

Any help would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:04:28+00:00Added an answer on May 27, 2026 at 3:04 am

    Found workaround:

    r2.unpack('U*').pack('v*').force_encoding('utf-8') 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running into a character encoding issue when I load a dropdown using jQuery
I am currently running into a problem where an element is coming back from
I am using Flex 4 and running into some problems displaying a simple alert
Running into a problem where on certain servers we get an error that the
Running into a problem. I have a table defined to hold the values of
Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints
I'm running into an issue where I have a FileUpload control in an UpdatePanel.
I'm running into a mental roadblock here and I'm hoping that I'm missing something
We're running into issues with how we specify font sizes. If we specify the
I'm running into a problem setting up my development environment. I've been working on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.