Solved

Formatting £ signs

Posted on 2003-11-10
11
267 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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 …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. 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 : Go t…

744 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

11 Experts available now in Live!

Get 1:1 Help Now