0

Upon dumping my Postgres database and looking at the outputted queries data, here is how it should look:

<p>Persons Name started August 1, 2011.&nbsp; We will provide a courtesy account for Fall 2011 and Winter 2012.&nbsp; He will need to join an existing subscription or create a new one for Spring 2012.</p> 

However from the point of the query being inserted into the text-area the output now looks like the following:

<p>Persons Name started August 1, 2011.  We will provide a courtesy account for Fall 2011 and Winter 2012.  He will need to join an existing subscription or create a new one for Spring 2012. </p> 
<p>Added web site info.</p> 

The non-breaking spaces (&nbsp;) are being converted to Â. This should not be happening. I am unsure of the cause behind this. Is this some kind of encoding issue?

Sidenote: TinyMCE is being used in another textarea in another spot in that same page. I've heard of conflicts with TinyMCE and textareas, so I thought it was worth noting this.

EDIT: I actually want the html tags to display as the tag itself. So <p> should not become a paragraph, it should actually stay as that. &nbsp; though should be converted to a space, not this weird character.

Edit2: The encoding character set used to be us-acsii, and that was the character set when these Database entries would have been saved via TinyMCE. It is now on UTF-8.

ComputerLocus
  • 3,448
  • 10
  • 47
  • 96
  • 1
    Is the database/table in UTF8, how about the HTML page do you have a `meta` tag for UTF8? – Sam Jun 19 '13 at 18:04
  • 1
    You use the word "textarea" but all I see are `

    ` tags. Is all of that inserted into a `

    – musicnothing Jun 19 '13 at 18:05
  • @SamSullivan Yes the Database is UTF8 and there is a UTF8 meta tag. – ComputerLocus Jun 19 '13 at 18:15
  • @AlexMorrise Yes it all is, and it is also suppose to stay appearing that way. On the other hand the non breaking spaces should actually appear as spaces. So, only part of it should be converted to actual html. If this is not possible, it is fine if the non breaking space tags are displayed as such, without conversion. – ComputerLocus Jun 19 '13 at 18:16
  • That makes me think it IS an encoding issue, since any html tags inside a ` – musicnothing Jun 19 '13 at 18:18
  • Have a look at this question: http://stackoverflow.com/questions/1461907/html-encoding-issues-character-showing-up-instead-of-nbsp – musicnothing Jun 19 '13 at 18:20
  • @AlexMorrise But I do have the encoding set in the document `` – ComputerLocus Jun 19 '13 at 18:24

2 Answers2

1

Try passing your output through the html_entity_decode() function in PHP. That should convert all the &nbsp html entities to spaces

-1

You should use htmlspecialchars on your input before putting it into the textarea.

musicnothing
  • 3,977
  • 24
  • 43
Peter Pivarc
  • 469
  • 2
  • 6