473,657 Members | 2,845 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hi there [htmlspecialchar s]Does nothing

Hi,

$new = htmlspecialchar s("<a href=", ENT_QUOTES, 'ISO-8859-15');
echo $new;

displays:

<a href

Instead of :

&lt; a href

I added the character set since this is a computer in Europe.

The PHP is the Win32 5.1.2

Thanks for your help

Jun 24 '06 #1
2 1856
Rik
universalbitmap per wrote:
Hi,

$new = htmlspecialchar s("<a href=", ENT_QUOTES, 'ISO-8859-15');
echo $new;

displays:

<a href

Instead of :

&lt; a href


It outputs &lt;a href=, if you view it with a browser it display's <a href,
instead of making an 'a' element. View your source.

If you want to display you special characters like &lt; in a browser: either
double yoiu htmlentities/htmlspecialchar s (so,
htmlspecialchar s(htmlspecialch ars($string))), or
str_replace('&' ,'&amp;',$strin g) after you have replaced ther characters.

Grtz,
--
Rik Wasmus
Jun 24 '06 #2

Rik wrote:
universalbitmap per wrote:
Hi,

$new = htmlspecialchar s("<a href=", ENT_QUOTES, 'ISO-8859-15');
echo $new;

displays:

<a href

Instead of :

&lt; a href


It outputs &lt;a href=, if you view it with a browser it display's <a href,
instead of making an 'a' element. View your source.

If you want to display you special characters like &lt; in a browser: either
double yoiu htmlentities/htmlspecialchar s (so,
htmlspecialchar s(htmlspecialch ars($string))), or
str_replace('&' ,'&amp;',$strin g) after you have replaced ther characters.

Grtz,
--
Rik Wasmus


Hi Rik,

I have done like you wrote, indeed I see &+lt+; if I select "source" in
IE6.

Many thanks

JiBé

Jun 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2448
by: |-|erc | last post by:
<?php // Get the names and values for vars sent by index.lib.php3 if (isset($HTTP_GET_VARS)) { while(list($name,$value) = each($HTTP_GET_VARS)) { $$name = $value; }; };
13
8520
by: Robert Zierhofer | last post by:
Hi all, I currently face a problem with htmlentities and german "umlaute". After moving my scripts to a new box (from Linux to FreeBSD) I had to see that htmlentities is not working anymore. The BSD Server (FreeBSD 5.1.2) runs PHP 4.3.9 and Apache 2 as well as the Linux Server does/did too. I also tried defining the charset with ISO 8859-1 as 3rd parameter in htmlentities but without a result.
15
6881
by: lkrubner | last post by:
I want to give users the power to edit files from an easy interface, so I create a form and a PHP script called "fileUpdate". It does a reasonable about of error checking and prints out some errors. It uses fileperms() to get the permissions of the file, and it includes that info in any error message. Today I'm getting the following error message. I've used SmartFtp to go in and set the test file's permissions to 777, but in this error...
8
3354
by: jasonbrown1999 | last post by:
Someone told me the following script could be used to run harmful commands on the server, by passing commands into the script. What the script does is encode an affiliate URL, create two frames, with the affiliate URL decoded and placed in the bottom URL. The top frame contains http://www.domain.com/selectanothercard.html for navigation back to the originating site. The script is accessed with a link like this: <a...
14
2665
by: dawnerd | last post by:
Hi, I am developing a CMS and came across something which has never happened to me before, and I re-wrote the specific script twice, both differently, and still had the same error. I'm not sure if it is apache, or php, or just an error I am not seeing. here is the code: <?php /** * Loop through the resultset
9
1724
by: Jeff Gardner | last post by:
Greetings: I have an UPDATE query (php 5.1.6/mysql 5.0.24a on apache 2.2) that appears to execute with no errors (php,mysql, or apache) but the data in the "UPDATED" table doesn't change. I've checked privileges for connecting account and that isn't an issue. Maybe it's my query: $editO = " UPDATE organization SET
8
2673
by: Erwin Moller | last post by:
Hi group, I could use a bit of guidance on the following matter. I am starting a new project now and must make some decisions regarding encoding. Environment: PHP4.3, Postgres7.4.3 I must be able to receive forminformation and store that in a database and later produce it on screen on the client (just plain HTML).
8
7910
by: mijn naam | last post by:
Can someone please explain to me why/when one would use htmlspecialchars instead of htmlentities? I know: if you only want to get certain characters translated. This is not the answer I'm looking for, I would like to know *why* you would want that, as opposed to a full translation.
1
2535
by: Punkis | last post by:
Hi again. I have a project that gets from mysql the data that i search. Until 10 minutes ago, the results could not display me correctly the Greek characters from mysql. The search system searches the title of the item which contains English and Greek characters. I solve this problem with this : I use notepad for any encoding i do between ansi, unicode and utf8. I wrote into notepad the title in English and for the Greek letters i...
0
8384
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.