Subject Re: [] Re: Dialect problem??
Author Helen Borrie
At 02:49 PM 5/02/2004 +0000, you wrote:

>Thanks for the response Helen,
>
> > Character validity has to do with character set, not SQL dialect.
>
>So how do I determine the character set and what characters are
>valid?? I assumed it was a dialect problem, if it isn't then great,
>but I still need to know what characters to filter out of my data to
>make the conversion to work properly.

Don't you know what is the default character set of your database? As to
the valid characters, you can google on the character set name usually, to
eventually find a chart for the particular code page that the character set
implements.


> > Show the SQL statement you are using to "convert" and "insert".
> > A blob is not a string. You can't convert a blob to a varchar
> > without using an external function - but you still won't be able
> > to use a character that is not in the character set.
>
>I understand that a blob is not a string, I'm using a delphi
>application to act as a datapump to convert the records. I'm using a
>query to read each blob record, converting it to a string using
>AsString and then reinserting it into the varchar(32000) using a
>second sql statement (DSQL) component.
>
>As I've stated before I'm looking for information about the validity
>of certain characters and where I can find such information.
>
>Out of 66000+ records this is the only one that fails (so far!).
>After I posted yesterday I did some more work on the actual data and
>it doesn't appear to be strictly the $ character thats causing the
>problem. It seems to be the funny apostrophe character (hex 92)
>that's in the data.

Now, that sounds weird. Are you talking about the "back-tick"
character? If so, it's certainly a special character on Linux and probably
has to be escaped in some environments. (But it's ascii 96 so it can't be
both that and hex 92...ascii 146 is a different character entirely, the
uppercase AE diphthong character) Could it be the left quote of a Word
"smart-quotes" single quote pair?

If (by a long shot) Delphi is converting the back-tick (or whatever it is)
to a regular apostrophe (ascii 39, or #39 in Delphic!) then you MUST escape
it in Firebird SQL the same way you have to in Delphi, because it is the
string delimiter in both languages. To escape the apostrophe you double it.

set myvarchar = 'O'Flaherty's Pub' will fail
but
set myvarchar = 'O''Flaherty''s Pub' succeeds. (That's double apostrophes,
not double-quotes).

Now, Delphi has the function QuotedStr() which will take care of these for
you. It would be worth at least a try - it wouldn't be out-of-the-way for
Delphi to try apostrophising the smart left quote or the back-tick...


>So once again, where can I find the information regarding valid
>characters for either character sets or dialects for Firebird.

You're not looking for "valid characters for Firebird", you're looking for
"valid characters for the codepage being used by database and
client". These codepages are specified in international standards usually
- the ISO ones are obvious, but the Windows ones (WIN..whatever) are
probably obtainable from the MDN.

> I've
>already looked through the Interbase docs that I've got but didn't
>spot anything that looked helpful. Have I missed something in those docs?

Probably not - though there is a bit of info on character sets at the end
of the Language Reference. To publish every code-to-image mapping for
every codepage would be a book on its own.

/heLen