[thelist] character encoding nightmare
anthony at baratta.com
Thu Mar 16 23:43:19 UTC 2017
Are you sending the second page the "sanitized" strings, or the raw strings from the form post? Are you running the htmlentities() function on the second page?
Since you are doing a form post to the second page, you might be double escaping the characters since the data needs to be URLEncoded for the second post if you are not sending the raw form post data.
> From: "Garth Hagerman" <hagerman at mcn.org>
> To: thelist at lists.evolt.org
> Date: 03/16/17 16:38
> Subject: Re: [thelist] character encoding nightmare
> >How are you copying data from DB 1 to DB 2 or are you sending data to both at the same time via the same script? Either way, How are you escaping / making the data safe for insertion into the DB?
> The updating scripts are not public; they’re in a password-protected folder for just me and my client. So, I’m not concerned about injection attacks. Maybe I should be.
> When we update, we enter data into forms on site1 (universitypressaudiobooks.com). The data goes through a script which uses htmlentities(). It also does some other character replacements, but I don’t think that’s likely to be the issue. The entity-ized strings get inserted or updated into DB1 and the updating page auto-submits a form with the same strings to a page on site2 (militaryaudiobooks.com) which does the same query with what’s supposedly the same data into DB2. But somehow the apostrophes and quotes go cuckoo on site2.
> > On Mar 16, 2017, at 4:02 PM, Garth Hagerman <hagerman at mcn.org> wrote:
> > Hello-
> > Is The List still alive?
> > I’ve got a problem which would probably be simple to solve if I knew more about character encoding, but, since I don’t, I’ve been flailing wildly and wasting a lot of time.
> > I’ll give you the short version. If somebody replies, I can supply further details.
> > I’ve got two MySQL databases running on different hosts. I’ve written a series of scripts which keep certain tables and fields synced between them.
> > The basic mechanics of this work fine, but certain characters turn to gibberish on the second site. The exact same html enity-ized strings are being inserted into both DBs, but apostrophes, etc. turn to gibberish on the second site.
> > Originally, I had everything with the sites’ pages using iso-8859-1encoding and the DBs set for Latin-Swedish collation. As I read about encoding problems, it was suggested I convert to UTF-8. That makes things worse.
> > I really don’t know what to try.
> > thanks in advance
> > Garth
> * * Please support the community that supports you. * *
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
More information about the thelist