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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:01:06+00:00 2026-06-15T11:01:06+00:00

BACKGROUND: I am looking to decode strings that include HTML entities – i.e. c#

  • 0

BACKGROUND: I am looking to decode strings that include HTML entities – i.e. “c#” should be converted to “c%23”.

I have found the HTMLEntities project to be generally recommended, but have also found what I think is a simpler solution: Using CGI.escape(*string*) or ERB::Util.url_encode(*string*).

QUESTION: Is there any reason why using CGI.escape or ERB::Util.url_encode for this task is a bad idea? If so, how exactly does one implement HTMLEntities in a Rails 3 project – I can’t seem to figure it out from the documentation!

  • 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-15T11:01:07+00:00Added an answer on June 15, 2026 at 11:01 am

    I’m not sure about the exact merits of each method. However, if you want to get the htmlentities working you need to add the following to your Gemfile:

    gem 'htmlentities', :git => "https://github.com/threedaymonk/htmlentities.git"
    

    and run:

    bundle install
    

    Then, in your controller:

    class TestController < ApplicationController
    
      def index 
        coder = HTMLEntities.new
        string = "<élan>" # or whatever string you want to manipulate
        @test = coder.encode(string) # => "&lt;élan&gt;"
      end 
    end 
    

    and then do whatever you want with the @test variable – write it out on your view page etc.

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

Sidebar

Related Questions

Background: I have a number of scripts that parse log files looking for hex
I have a clickable TextView with a drawable as its background. I'm looking for
Background: This is something I have been looking for since before even JSON was
I'm coming from the .Net MVC background looking to do a project in RoR.
Background Conceptually, I am looking for a tool, or suite of software tools that
I'm looking for a workaround that would allow me to remove the background from
I am looking for a way to have the background-images (CSS) load as if
I am looking to add a background to images that users upload that are
I'm looking for a pc app that runs in the background and collates simple
I'm looking to change the hue of my background image (PNG) programmatically. How can

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.