473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to render special character in HTML page

Guys I'm having so much difficulty in rendering special character to my html page. The character listed below are some of the chars I'm trying to render. I'm retrieving the character from mysql database using PHP the to HTML. I've enclosed the chars in single quote.

'´' 'Ñ' 'ñ' 'é' 'è' 'ë' 'ö' '“' '”' '’' '—' '–' '™' '§'

Please help me.

Thanks a lot.
Jul 9 '10 #1
3 2149
JKing
1,206 Expert 1GB
Hi there.
I think what you are looking for is htmlentities().

Have a look at this link: PHP htmlentities
Jul 9 '10 #2
Have tried it htmlentities() already but it doen't work.
Locally on my machine I was able to resolve it.
I used the code below.

Expand|Select|Wrap|Line Numbers
  1. function specialCharsToHtml($str){
  2. $match_pattern =       array('´', 'Ñ', 'ñ', 'é', 'è', 'ë',
  3. 'ö', '“', '”', '’', '—', '–', '™', '§',
  4. 'á');
  5. $replacement_pattern = array(''','Ñ','ñ', 'é', 'è', 'ë',
  6. 'ö', '“', '”', '’', '—', '–', '™', '§',
  7. 'á');
  8. return str_replace($match_pattern, $replacement_pattern, $str);
  9. }
  10.  
  11.  
When I uploaded it to my site, it doesnt work.
Jul 9 '10 #3
JKing
1,206 Expert 1GB
@dagam3rz
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $str = "´ Ñ ñ é è ë ö “ ” ’ — – ™ §";
  3.  
  4. echo htmlentities($str, ENT_QUOTES, 'cp1252');
  5. ?>
  6.  
That properly translates all characters to their html entities for me.
Jul 9 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Bal | last post by:
Hi, I am trying to generate a pdf using a XML file and rendering the page through XSL Stylesheet to a PDF. But the page has some special characters, as its for a chequ website. My Code below is...
7
by: Art M | last post by:
I saved an html page the other day that encoded some punctuation with codes like â?T --> apostrophe (in case those characters don't show up in your news reader that's a_circumflex + euro +...
50
by: The Bicycling Guitarist | last post by:
A browser conforming to HTML 4.0 is required to recognize &#number; notations. If I use XHTML 1.0 and charset UTF-8 though, does &eacute; have as much support as é ? Sometimes when I run...
2
by: Ozer | last post by:
Hi friends, I wanna ask something. I use javascript menu on my user interface. And the js files contains special(turkish) character. I need to use codepage=1254 attribute in my @Page tag. If i...
82
by: Eric Lindsay | last post by:
I have been trying to get a better understanding of simple HTML, but I am finding conflicting information is very common. Not only that, even in what seemed elementary and without any possibility...
2
by: weetat.yeo | last post by:
Hi all , I have a form that allow user to enter description , sometimes the description value have html special character for example %20 and etc. Inserting into the mysql database is ok , for...
7
by: SteveM | last post by:
I am sure this is an easy question, but being relatively new to ASP.NET programming, I can not quite grasp what I need to accomplish what I need to do. What I have is a word document that is...
0
by: halex | last post by:
Hello, I need to save to file HTML page from my complex ASPX page (it has MasterPage, MainContainer, UserControls, CSS, JS files...). So, I need to override Render method to to this but I did not...
14
by: doublestack | last post by:
I am calling a variable from an aspx page (LOGON_USER) into a url and need to remove the special character "\" so the user can be logged in correctly. I am using: <script...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.