Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Formatting £ signs

Posted on 2003-11-10
11
Medium Priority
?
277 Views
Last Modified: 2013-12-24
Hi

I've just converted a database from Access to MySQL.  

I have a field in the database which includes characters such as £, but when they are displayed on the web page they come out as ᆪ.  The data type for the field in MySQL is 'text'.

Is the data type correct or should I convert special characters within coldfusion?

Thanks in advance.
0
Comment
Question by:nelliott
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 1

Expert Comment

by:kjuliff
ID: 9715808
£ is the character code for pound sterling. I would sore as such and it should display properly. Astually I wouldn't store it but I'd output £ whenever the relevant text was found.
0
 
LVL 11

Expert Comment

by:hart
ID: 9720001
just replace in the front end while displaying, the datatype is proper

Regards
Hart
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9720238
Hi

When inserting teh values in the DB - use a HTMLEditFormat() & get ur pound signs replaced with their HTML equivalent.

then u can insert this string in the DB & display them as it is on the browser - without ne-problems :)

take a look at this example !

heres the eg :

save this file as x.cfm & just run it ... & then type whatever u want in the textarea with HTML & CF TAGS / Special characters etc !

<CFparam DEFAULT="" NAME="x">

<form name"frm" ACTION="x.cfm" METHOD="post">
   <textarea name="x" ROWS="10" COLS="50">type in ur text here with html & cf tags</TEXTAREA>
   <INPUT TYPE="submit">
</FORM>

<CFOUTPUT>    
   <P>#HTMLCodeFormat(x)#</p>  
</CFOUTPUT>

It shld replace teh pound sign with its HTML equivalent as well !

let me know ...

K'Rgds
Anand
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:nelliott
ID: 9720714
I'm trying to display a Bulletin Board, so when a Joe Bloggs enters an item in 'for sale', for example, I wouldn't expect them to know CF or HTML tags.

If it happens for the £ sign, then how can I be sure that it's going to happen for other punctuation marks as well?  Surely there must be a standard solution other than getting Coldfusion to check for each piece of punctuation and then give it an alternative to replace it with (or am I presuming too much!)?

At present the text is shown as so, so that user's don't have to enter <p></p> or <br> tags when entering text into a textarea:

#Replace(bulletinBoard.CONTENT, chr(13) & chr(10), "<br>","ALL")#

I've increased the points as a quick solution is required...

Thanks in advance
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9720801
did u try the example i gave u

input all the punctuation marks u want & see the output u get [chk the source of the output in the browser & u'll know why i asked u to try the example]

read help on htmlcodeformat for more info thru CFDocs
0
 

Author Comment

by:nelliott
ID: 9720841
Changing htmlcodeformat has very strange side effects.

a) it doesn't seem to have any effect whatsoever on the punctuation marks,
b) it puts all of the text into a default font (rather than using the CLASS it's suppose to), and
c) it puts all of the text onto one long line, rather than wrapping the text into a table cell of width 400!

0
 
LVL 17

Expert Comment

by:anandkp
ID: 9721167
htmlcodeformat actually escapes all special characters (> < " &) & repalce all carriage returns & encloses them inside <pre> tags - thats why u see those strange side effects.
but looks like its not doing it for the "pound sign" !

I guess during conversion from access to sql - its got replaced with junk ... else i have my SQL DB & i tried inputting them with pound signs - but it displays fine. it even handles "euro".


0
 

Author Comment

by:nelliott
ID: 9721215
It's bizarre, I'll admit!

I've checked most other punctuation and it seems fine with it.  It just seems to be having a bit of a wobbly with the pound sign.

I've gone in and changed the &#65443; symbol for pound signs in MySQL and yet it still comes back as &#65443;.  Very annoying!

As a quick fix, how do I change the following code to include a check for pound signs and ensure they are outputted as '£'  (i.e. not worry about any other punctuation for now)?

#Replace(bulletinBoard.CONTENT, chr(13) & chr(10), "<br>","ALL")#

Thanks in advance
0
 
LVL 17

Accepted Solution

by:
anandkp earned 1000 total points
ID: 9728660
hi,

Use the following code for formatting the text entered in textarea !
ReplaceList(text,'<,>,#Chr(10)#,#Chr(13)#','&lt;,&gt; ,<BR>')


& abt replacing the pound sign - have a look at the following code !
<CFSET text = "anandkp &##65443;500">
<CFOUTPUT>#Replace(text,'##65443','pound')#</CFOUTPUT>

HTH

K'Rgds
Anand
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question