Jump to content

how to remove a "pilcrow" character from a field


solarisuser

Recommended Posts

Hello All,

I have a field that has a few thousand lines of data with a ¶ after the data (like "John¶").  It happened after I imported a lot of data. 

I tried using "select rtrim(field) from table" but it doesn't seem to remove it.

Does anyone know what MySQL statement will remove it?

Thanks!!
Link to comment
Share on other sites

[quote author=artacus link=topic=117678.msg480295#msg480295 date=1165466989]
I'm not sure but it sounds like you've got the wrong character set.

Try SELECT CONVERT(field USING latin1) FROM table and see what that does.
[/quote]

It doesn't work -- it might be because I'm using an old version of mysql.. 4.0.X....

Any other suggestions? =(
Link to comment
Share on other sites

A pilcrow huh? I learned something new today.

See if this works:
UPDATE mytable SET myfield = REPLACE(myfield,'¶','')

If it doesn't you'll have to do it in PHP using
str_replace(chr(182),'',$row['myfield']);

you can use ord() and chr() to get to wierd non-printable characters.
Link to comment
Share on other sites

thanks for the suggestion, but it didn't seem to work.

If I use the MySQL Query Browser, and edit the field, it actually shows the "pilcrow" expressed as a paragraph and if I just backspace to get rid of the newline it makes, and save the field, the pilcrow go away.

I can't use any PHP magic because I need to stop duplicate entries from going to PHP. 

Here's the issue:

One field has "Data", and another field has "Data¶".
When I do a "SELECT DISTINCT * from data", it shows both of those in a <select> dropdown, effectly showing two of the same names. (The select dropdown seems to ignore the pilcrow).

Any help is very much appriciated as I can't find any info on google about it!

Thanks

[quote author=artacus link=topic=117678.msg481212#msg481212 date=1165597972]
A pilcrow huh? I learned something new today.

See if this works:
UPDATE mytable SET myfield = REPLACE(myfield,'¶','')

If it doesn't you'll have to do it in PHP using
str_replace(chr(182),'',$row['myfield']);

you can use ord() and chr() to get to wierd non-printable characters.
[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.