I have a Rails app. One of my clients is importing French Text which
is appearing weirdly. Check below example:

    1. str = "--- \nFrench: \"3. Combien de r\\xC3\\xA9gions y a-t-il
au Cameroon?\"\nEnglish: 3. How many regions are there in Cameroon?\n"

Can someone assist please?

I am thinking on following lines:

    2. str = str.gsub('"', '')

    3. **Need to add a line which replaces \\ in the str above to just
\**

    4. str = str.force_encoding("iso-8859-1")

    5. str = str.encode('UTF-8')

In step 3, I was thinking of something like

    str = str.gsub(/\\\\/, "\\")

OR somehow if possible push output of puts or a similar function back
to str example:

    > puts str

    ---

    French: 3. Combien de r\xC3\xA9gions y a-t-il au Cameroon?

    English: 3. How many regions are there in Cameroon?

but even that works. Can someone please assist?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to