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 8711757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:57:43+00:00 2026-06-13T04:57:43+00:00

I have a directory with of 300+ HTML files that I need to parse

  • 0

I have a directory with of 300+ HTML files that I need to parse data from and place into a new HTML template which works well with the exception of pre-rendered HTML Entities such as square root √ that appear in some of the files. I have read a ton of posts over the last few hours about encoding in Ruby 1.9 and tried things like:

File.read( "_pending/testdir/filename.html", :encoding=>"UTF-8" )

and

trans = Iconv.new( 'UTF-8', 'IBM437' )
input_text = File.read( "_pending/testdir/filename.html" )
output_text = trans.iconv( input_text )
puts output_text

All with no luck. Once converted the square root symbol still appears as √ in the browser as well as in the raw HTML markup with the exception of the Iconv solution which outputs AªAo to console when it puts.

Setup

Windows Server 2008 R2

ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

The encoding name returns IBM437 when I do HTML_FILE.external_encoding.name.

  • 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-06-13T04:57:45+00:00Added an answer on June 13, 2026 at 4:57 am

    You have to be kidding me…

    The fix was to set a content header in the HTML template page. I’m guessing the console was outputting valid UTF-8 but not in a recognizable format.

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    While I feel pretty stupid right now, I’m sure someone else is going to run into something similar so if that’s you: I feel your pain; I just hope you didn’t spend the last 6 hours troubleshooting as I have.

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

Sidebar

Related Questions

I have directory with > 1000 .html files, and would like to check all
I have a directory OUTPUT where I have the output files from a Map
I have PDB(text) files which are in a directory. I would like to print
My problem is that I have too many files in single directory. I cannot
I have directory a that is symlinked somewhere. I want to copy its contents
I have directory A with files matching directory B. Directory A may have other
Let's say I have Directory 1 and Directory 2, and each can have files
I have 4 input fields that when numbers are entered into one of the
I have a series of data that is produced by state and information type.
I have an Image() object, which I need to resize. I am using it

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.