Connecting Tech Pros Worldwide Forums | Help | Site Map

converting data

WindAndWaves
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi Gurus

I have a database full of text that I have downloaded from a website (ftp download, read file, parse file (i.e. break it down into
parts), move it into a table, etc...).

My next step now is to load this data into a MySQL database on the net for a PHP website.

HOWEVER, the funny characters on the original website (e.g. unicode characters, etc.... etc...) are doing really nasty things. The
MySQL thaat I use does not support unicode, so I want to reduce it down to just asci characters (to keep it simple).

I have two questions:
a. how do I make sure that all the data in my database are ascii characters?
b. do you agree with my course of action or do you suggest another way?

TIA

- Nicolaas



WindAndWaves
Guest
 
Posts: n/a
#2: Nov 13 '05

re: converting data



"WindAndWaves" <access@ngaru.com> wrote in message news:SXgMd.14399$mo2.1122609@news.xtra.co.nz...[color=blue]
> Hi Gurus
>
> I have a database full of text that I have downloaded from a website (ftp download, read file, parse file (i.e. break it down into
> parts), move it into a table, etc...).
>
> My next step now is to load this data into a MySQL database on the net for a PHP website.
>
> HOWEVER, the funny characters on the original website (e.g. unicode characters, etc.... etc...) are doing really nasty things.[/color]
The[color=blue]
> MySQL thaat I use does not support unicode, so I want to reduce it down to just asci characters (to keep it simple).
>
> I have two questions:
> a. how do I make sure that all the data in my database are ascii characters?
> b. do you agree with my course of action or do you suggest another way?
>
> TIA
>
> - Nicolaas
>
>[/color]

If anyone is interested in an answer to this question, I basically did the following to find out where the non-asci characters where
and then replaced them.

function ascionisetable(mytable as string)
dim r as recordset
dim f as field
dim x as string
dim y as long
dim i as long
dim ii as long
dim s as string

set r = currentdb.openrecordset(mytable)
do while not r.eof
for each f in r.fields
s = nz(f.value, "")
ii = len(s)
for i = 1 to ii
x = mid(s,i)
y = ascw(x)
select case y
case is<0, is > 128, 64, 34, 39 'these are special characters in html (e.g. >, <, ", ')
'record and replace (using conversion table
next i
next f
r.movenext
loop


Closed Thread