473,602 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert the euro and pound sign

hi there,

it seems as if i can´t convert the euro and pound sign to their html
equivalents.

i tried
eregi_replace(" €", "€", $haystack);
eregi_replace(" £", "£", $haystack);

as well as
str_replace("&e uro;", "€", $haystack);
str_replace("&p ound;", "£", $haystack);

to the script:
the values are coming from a http form post.
i thought the the problem could be maybe some wacko encoding that is
done because of the form.

any ideas??

muchas gracias in advance
rob

Jul 17 '05 #1
4 25919
> hi there,

it seems as if i can´t convert the euro and pound sign to their html
equivalents.

i tried
eregi_replace(" €", "€", $haystack);
eregi_replace(" £", "£", $haystack);

as well as
str_replace("&e uro;", "€", $haystack);
str_replace("&p ound;", "£", $haystack);

to the script:
the values are coming from a http form post.
i thought the the problem could be maybe some wacko encoding that is
done because of the form.

any ideas??

muchas gracias in advance
rob

Hi rob,

1. Check if you're editing your file with the same encoding that how the
file is displayed. If not, try to force the file encoding with a special
header like <?xml version="1.0" encoding="iso-8859-15"?>
2. Some browsers don't understand &euro; and &pound;, try changing them to
their numeric equivalent (I don't know them but it must look like {)
--
Alexandre Lahure
Point 52, Solutions Internet "Ready to Start"
http://www.point52.com/

"Computers are like air conditioners,
They don't work when you open windows"
Jul 17 '05 #2
Alexandre Lahure wrote:
hi there,

it seems as if i can´t convert the euro and pound sign to their html
equivalents.

i tried
eregi_replace(" €", "&euro;", $haystack);
eregi_replace(" £", "&pound;", $haystack);

as well as
str_replace("&e uro;", "€", $haystack);
str_replace("&p ound;", "£", $haystack);

to the script:
the values are coming from a http form post.
i thought the the problem could be maybe some wacko encoding that is
done because of the form.

any ideas??

muchas gracias in advance
rob


Hi rob,

1. Check if you're editing your file with the same encoding that how the
file is displayed. If not, try to force the file encoding with a special
header like <?xml version="1.0" encoding="iso-8859-15"?>
2. Some browsers don't understand &euro; and &pound;, try changing them
to their numeric equivalent (I don't know them but it must look like
{)

hi alexandre,

the problem more the fact that i can´t "grab" them rather than the display.
meaning - ereg_replace finds neither the euro sign (€) nor the pound
sign (£). so i don´t even get to the point where &euro; could be displayed.
the process again:

form post -> ereg_replace -> write to db

but as said the ereg_replace doesn´t find the euros and pounds to
convert them.

do you know what i mean?

all the best
rob

Jul 17 '05 #3
> hi alexandre,

the problem more the fact that i can´t "grab" them rather than the
display.
meaning - ereg_replace finds neither the euro sign (€) nor the pound
sign (£). so i don´t even get to the point where &euro; could be
displayed.
the process again:

form post -> ereg_replace -> write to db

but as said the ereg_replace doesn´t find the euros and pounds to
convert them.

do you know what i mean?

all the best
rob


I had a similar problem with people filling my forms under windows and who
cut&pasted text from Notepad to the HTML inputs or textareas. The text
typed in Notepad wasn't iso-8859-15 but windows-cp125? so I wasn't able to
see special characters like euro.
All I managed to do is tell them to not cut&paste into forms...
Sorry

--
Alexandre Lahure
Point 52, Solutions Internet "Ready to Start"
http://www.point52.com/

"Computers are like air conditioners,
They don't work when you open windows"
Jul 17 '05 #4
On Fri, 07 Nov 2003 14:16:53 +0100, Robert Zierhofer <ro*@starbugg.d e> wrote:
it seems as if i can´t convert the euro and pound sign to their html
equivalents.

i tried
eregi_replace( "€", "&euro;", $haystack);
eregi_replace( "£", "&pound;", $haystack);

as well as
str_replace("& euro;", "€", $haystack);
str_replace("& pound;", "£", $haystack);

to the script:
the values are coming from a http form post.
i thought the the problem could be maybe some wacko encoding that is
done because of the form.

any ideas??


The main gotcha with the Euro is that it's a different code point under
different character sets.

iso-8859-1 doesn't have it at all - it was created before the Euro existed.

iso-8859-15 has it as chr(164), replacing the universal currency symbol that
was in that code point in iso-8859-1.

To make it worse, Windows codepage 1252 has it in chr(128).

In Unicode it's U+20AC (i.e. 20AC in hexadecimal; the actual representation
depends on the encoding, e.g. UTF-8).

Some charts of the character sets here:

http://en.wikipedia.org/wiki/ISO-8859-1
http://en.wikipedia.org/wiki/ISO_8859-15

So - check your input data to see whether it's using chr(164) or chr(128) - or
something else.

Then check your script to see whether the literal € you have there is encoded
with the same code point. If not - try using chr(164) or chr(128) as
appropriate.

The headers in your post indicate you posted using:

Content-Type: text/plain; charset=windows-1252; format=flowed
^^^^^^^^^^^^^^^ ^^^^^

So the Euro in your message must be chr(128); copying it into a hex editor
confirms that. I bet your data is encoded with an iso-8859 based character set,
so it's chr(164).

Not sure about the £ though since that doesn't differ between the commonly
used character sets; chr(163).

--
Andy Hassall (an**@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #5

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

Similar topics

2
5671
by: SPG | last post by:
Hi, I am haveing some problems with getting the correct XML response from a Servlet. I have data that contains the euro sign ( 0x80 = ?) and the string I am trying to print out to the response definitely has the correct formatting.. Here is some sample code: import java.io.*; import javax.servlet.*;
4
16804
by: ben | last post by:
Hi all, I have a simple PHP page that takes values from a form and puts them in a database (MySQL). The code is in a file test.php, which I have typed in at the bottom of this post (please excuse any typos). This page is not a production page - I created it just to try and solve the £ sign problem I am having. When I put the pound sign (£) into the input box and submit the form,
5
7959
by: Waldy | last post by:
Hi there, I am using the .Net XML Serialization classes to create XML strings. This has been working fine up until the point that one of the strings contained a pound sterling symbol. The application that is processing the output complains about the character. Both the strings and the application are using UTF-8. If you view the text in Notepad the pound symbol looks fine, but if you view the hex, there is a character preceding the...
7
3308
by: kingski | last post by:
Any idea about this ? http://www.developerfusion.co.uk/forums/thread/114379/#114379 "Can any one help me as i am building a shopping cart and it supports multiple currencies but while sending confirmation mail o customer it does not show euro sign before amount he paid but it is showing a queston mark over there. It is working fine with Dollar sign and Pound Sign but this Euro is creating problem. " thanks.
0
1110
by: kingski | last post by:
Any idea about this? http://www.developerfusion.co.uk/forums/thread/114379/#114379 "Can any one help me as i am building a shopping cart and it supports multiple currencies but while sending confirmation mail o customer it does not show euro sign before amount he paid but it is showing a queston mark over there. It is working fine with Dollar sign and Pound Sign but this Euro is creating problem. " thanks.
4
4981
by: Kim | last post by:
Inserting a record through sql (asp, msaccess textfield), inserting the euro sign "?" shows up like a questionmark "?" in the output. I have <%@ LANGUAGE="VBSCRIPT" CodePage=28591 LCID=2077 %at the top of the page where the insert statement is but still the euro sign is inserted like something else (by looking at the data in the access database the euro sign looks like a little square "€") Whats wrong? Kim
9
2563
by: ballygowanboy | last post by:
ok, so i've my front end shop code almost working, the quantity and price all add up........ now i need to add a curency conversion function, euro (default), dollar, and uk pound. right, i'm not sure if i should have 3 seperate functions, that do the math on the total box, and add the required, €, £ or $ icon....... it would be best to put this in one function. ok, here's my first atempt, getting a NaN result...... i've set the values in...
3
3239
by: Georg Weiler | last post by:
Hi, I have a database PostgreSQL entry that includes the string € which is the euro sign. When I retrieve the string through a PHP SQL statement and then echo the result to the browser, it shows the correct euro sign, but in the source code, it still says € ... This is a problem to me, because I generate a PDF, and in this it still
1
2578
by: AAGazer | last post by:
Hi, For some reason str_ireplace and str_replace do not remove the euro symbol. This is the code snip it: $mremoveArray=array("€","£"); $tString=”15,00€”; $pa=str_ireplace($mremoveArray,'',$tString); The pound sign is removed but not the euro.
0
7993
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
7920
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,...
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
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
8268
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
6730
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...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1254
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.