Solved

Formatting £ signs

Posted on 2003-11-10
11
268 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
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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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 250 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to solve ssl error handshake failure alert on IE 1 162
Web Development Tools for MVC 3 75
spamming  on Hosted svrs? 6 73
Widget to get customer remakrs in our website. 3 44
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to Import and export files in 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 : Click on Too…

914 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now