Solved

Formatting £ signs

Posted on 2003-11-10
11
271 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ColdFusion Rereplace 3 87
Search on a site 5 131
ASP.NET on IIS website not sending PDF file anymore ? [IzillaFramework Cognition] 6 46
Problem to copy file 14 45
In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

735 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