Subject RE: [firebird-support] LTRIM and RTRIM failures
Author Rick Debay
Ah hah! The character at position 11 is -96, which is 160 unsigned,
which happens to be a non-breaking space in HTML. Given that some of
our data comes from screen scrapes, it looks like we scraped off some
nbsps!

Sorry for bothering everyone. Have a good weekend.

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Rick Debay
Sent: Thursday, May 11, 2006 5:40 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] LTRIM and RTRIM failures

I'm getting this via email, thus the top-posting.

The VARCHAR field is actually a domain:

CREATE DOMAIN D_PO AS
VARCHAR(16)
COLLATE ISO8859_1;

Production is running LI-V6.3.1.4481 Firebird 1.5 which I think is
1.5.1.

> This one looks ok too.
That was a sanity check. The strange one is the ASCII_VAL showing 32,
but LTRIM and RTRIM showing something else. Unless... I only checked
one character, maybe the LAST character is not a space?

I won't be able to respond again until Monday, you see I have to take my
son to Disneyworld. Sometimes it pays to be a parent :-)

Rick

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Milan Babuskov
Sent: Thursday, May 11, 2006 4:31 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] LTRIM and RTRIM failures

Rick Debay wrote:
> Table DDL shows the field as VARCHAR.

Oh, I see it now. Well, now you know why top-posting is Bad(tm). I
didn't bother to read rest of the message as you placed the question on
top:

http://lists.freebsd.org/pipermail/freebsd-chat/2004-August/002567.html


As for original question...

> Let's test that particular item again > Select strlen(po.PO),
strlen(ltrim(rtrim(po.PO))) > from RPL_PO po where po.ID = 3144 >
Results: 11, 11

I guess this is the problem? However, I'm unable to reproduce it (as
shown below). Perhaps you could give more details: FB version, operating
system, database (and column) charset.

I took FB2.0 and used the EMPLOYEE database:

update employee
set first_name = ' Robert '
where first_name = 'Robert';
commit;

select
'*'||first_name||'*' original, strlen(first_name) len,
'*'||ltrim(first_name)||'*' ltrimmed, '*'||rtrim(first_name)||'*'
rtrimmed, '*'||ltrim(rtrim(first_name))||'*' bothtrim,
strlen(ltrim(rtrim(first_name)))
from EMPLOYEE
where first_name CONTAINING 'Rob';

returns:

ORIGINAL LEN LTRIMMED RTRIMMED BOTHTRIM STRLEN
------------- --- ----------- ---------- --------- ------
* Robert * 11 *Robert * * Robert* *Robert* 6
*Roberto* 7 *Roberto* *Roberto* *Roberto* 7


Everything looks ok to me.


> Hmmm, let me put quotes around it in order to see leading or trailing
> characters > select '''' || po.PO || '''' from rpl_po po where po.ID
= 3144
> Results: '2895-01V '
>
> Let's test LTRIM and RTRIM and see what they return > select >
strlen(ltrim(rtrim(' xxx '))), > ascii_val(substring(' xxx ' from 5 for
1)) > from rdb$database > Results: 3, 32

This one looks ok too.


--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item on
the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links








------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/67folB/TM
--------------------------------------------------------------------~->

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item on
the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links