Welcome to WebmasterWorld Guest from 54.227.110.209

Forum Moderators: phranque

Message Too Old, No Replies

Macintosh Text Problems

How do I rid weird characters?

     

knighty

11:46 am on Feb 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I develop a news page using PHP & MYSQL, I import a CSV file (from the news source) but get a lot of strange characters where apostrophes etc. are supposed to be.

Is there some way of getting rid of/filtering these out?

For example where apostrophes should be im getting an O with 2 dots above it.

jatar_k

7:45 pm on Feb 27, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



do you process the file before you insert it?

I was looking at php.net for a stripping or converting function. you could try something like htmlspecialchars() it might read them right and the dump them into the DB properly and then if you get them and show them in HTML they might come up right but this is a shot in the dark.

when I got files from a PC I used to run a BBedit script I have to convert the PC chars to Mac but that doesn't really help.

If you have a set of chars that you know are wrong and what they come out as you could parse the files on the way in and use regex to replace them.

EliteWeb

8:03 pm on Feb 27, 2002 (gmt 0)

WebmasterWorld Senior Member eliteweb is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Depends on the text editor. Try a different one :)

GoV

5:34 am on Mar 4, 2002 (gmt 0)

10+ Year Member



Hey there...

As a Mac developer myself, I know that it does depend on your text editor. If you are editing any server scripts you need to use a safe text editor or script editor.

For my Perl scripts, SQL, Java and so on - Adobe GoLive will open any of these and allow for safe editing - without the added zeros and such that your speaking about.

These also are great:
MS Word
Mac Perl [macperl.org...]

Mac Simple Text by the way is not the best editor on earlier OS 9. But Simple Text for OS X is a good bet.. just make sure to set to plain text and not rich text (RTF) as you know Mac OS X is Unix base (grin) so your scripts should be easier to edit there.

Enjoy and hope this was a help.
~GoV

knighty

9:05 am on Mar 4, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks for the respones.

The problem is that when I open the CSV in Excel it all seems fine, I save it as a tab delimeited TXT file and import it onto MYSQL DB but then as soon as I view the output - it goes pear shaped.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month