Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Formatting £ signs

Posted on 2003-11-10
11
Medium Priority
?
282 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
9 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…

578 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