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

  • Home
  • SEARCH
  • 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 7407659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:45:45+00:00 2026-05-29T05:45:45+00:00

I am parsing some text in Ruby that contains Unicode character that I would

  • 0

I am parsing some text in Ruby that contains Unicode character that I would like to transcribe to ASCII values in one output file and HTML encoding in another. Is there a simple way of spitting out the non-ASCII characters found in a file? For example:

\u00A0 #should become a " " in the text text file, but   in the html output file

I’m going to manually transcribe them based upon my needs and would like to output a list of unique characters I’ll need to transcribe from my initial input file.

Thanks,
Ben

  • 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-29T05:45:47+00:00Added an answer on May 29, 2026 at 5:45 am

    There’s a method that helps to extract the characters found in your string:

    "foo\u00A0bar".chars.to_a
    # => ["f", "o", "o", " ", "b", "a", "r"]
    

    Since some of these characters may be multi-byte UNICODE characters you might want to expand that into bytes as well, to be more thorough:

    "foo\u00A0bar".chars.to_a.collect { |c| [ c, c.bytes.to_a ] }
    # => [["f", [102]], ["o", [111]], ["o", [111]], [" ", [194, 160]], ["b", [98]], ["a", [97]], ["r", [114]]]
    

    The array breaks down the specific bytes used to construct that character. In this case the non-breaking space shows up as " " but is actually [194, 160] internally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that is parsing the html page and extracts some text
I am doing some text parsing using flip-flop operator and my data looks like
I'm trying to use Antlr for some text IDE-like functions -- specifically parsing a
I am parsing some enum values from a text file. In order to simplify
I am currently parsing some HTML code and I would like to put in
I am parsing some text and it would make my life easier if i
in ruby/rails3, I need to do some heavy text parsing to find a certain
I have a list that I create by parsing some text. Let's say the
I'm dealing with some text parsing in Python and for that purpose, it's good
Today I've looked over some C code that was parsing data from a text

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.