Myrna van Lunteren <[email protected]> writes:
> On Thu, Dec 8, 2011 at 4:21 AM, <[email protected]> wrote:
>> Hello,
>>
>> I'm trying to use UCASE to "normalize" different case variants of
>> text field values. There's just a little problem. It works fine for
>> all normal characters including German umlauts (Ä, Ö, Ü, ä, ö, ü)
>> ...
>>
>>
>> ==vv= COPIED FROM IJ CONSOLE =vv==
>> ij> VALUES UCASE('ÜbErSeTzUnG');
>> 1
>> -----------
>> ÜBERSETZUNG
>>
>> 1 Zeile ausgewählt
>> ==================================
>>
>>
>> ... but it seems to cause trouble with the "German Sharp S": ß
>> (See http://en.wikipedia.org/wiki/Sharp_S)
>>
>>
>> ==vv= COPIED FROM IJ CONSOLE =vv==
>> ij> VALUES UCASE('Straßenbahn');
>> 1
>> -----------
>> STRASSENBA&
>>
>> 1 Zeile ausgewählt
>> ==================================
>>
>>
>> It correctly (!) replaces "ß" by "SS" but then it truncates the resulting
>> string, thereby appending an ampersand "&".
>>
>> How can I make it return the complete, correct result "STRASSENBAHN"?
>> (Which, by the way, means "streetcar". ;-))
>>
>>
>> My DERBY_OPTS look like this:
>> DERBY_OPTS=-Dderby.ui.locale=de_DE -Dderby.ui.codeset=Cp850
>>
>>
>> Many thanks in advance for your help!
>>
>> --
>> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
>> Jetzt informieren: http://www.gmx.net/de/go/freephone
>
> Hi,
>
> The value is likely returned correctly, but you're hitting the maximum
> display width for columns in ij.
> This is controlled by the property ij.maximumDisplayWidth, and you can
> also set it during your ij session using maximumDisplayWidth.
> I think the default is 10.
The default is 128, actually, which should be enough for Straßenbahn. :)
It looks like the result set meta-data gets confused by this
transformation, as can be seen by this code snippet:
Connection c = DriverManager.getConnection(
"jdbc:derby:memory:db;create=true;territory=de_DE;" +
"collation=TERRITORY_BASED");
Statement s = c.createStatement();
ResultSet rs = s.executeQuery("values upper('Straße')");
System.out.println(rs.getMetaData().getPrecision(1));
rs.next();
System.out.println(rs.getString(1));
This prints
6
STRASSE
So it seems the value is returned correctly, but the meta-data is wrong
(STRASSE is 7 characters long, not 6). ij uses the meta-data to
determine how much space each column should have.
--
Knut Anders