Skip to Content.
Sympa Menu

grouper-users - Re: [grouper-users] Fetching Stems with Umlauts

Subject: Grouper Users - Open Discussion List

List archive

Re: [grouper-users] Fetching Stems with Umlauts


Chronological Thread 
  • From: Mirko Tasler <>
  • To: Chris Hyzer <>,
  • Subject: Re: [grouper-users] Fetching Stems with Umlauts
  • Date: Tue, 15 Sep 2009 11:00:44 +0200


Since I haven't tested this with group names, I'm not sure about the results there. Here's something similar to the Java class I use for testing. (To run this, you'll need grouperClient.jar and dependencies as well as grouper.client.properties).

*** snip ***
import edu.internet2.middleware.grouperClient.api.GcFindStems;
import edu.internet2.middleware.grouperClient.api.GcStemSave;
import edu.internet2.middleware.grouperClient.ws.GcTransactionType;
import edu.internet2.middleware.grouperClient.ws.beans.WsFindStemsResults;
import edu.internet2.middleware.grouperClient.ws.beans.WsStem;
import edu.internet2.middleware.grouperClient.ws.beans.WsStemLookup;
import edu.internet2.middleware.grouperClient.ws.beans.WsStemQueryFilter;
import edu.internet2.middleware.grouperClient.ws.beans.WsStemToSave;

public class GrouperClientUmlautTest {

public static void saveStem(String stemName) throws Exception {
System.out.println("Saving stem: " + stemName);
GcStemSave gcStemSave = new GcStemSave();
WsStem wsStem = new WsStem();
wsStem.setName(stemName);
WsStemToSave wsStemToSave = new WsStemToSave();
wsStemToSave.setWsStemLookup(new WsStemLookup(stemName, null));
wsStemToSave.setWsStem(wsStem);
gcStemSave.addStemToSave(wsStemToSave);
gcStemSave.assignTxType(GcTransactionType.NONE).execute();
}

public static void getStems(String parentStem) throws Exception {
String queryFilterType="FIND_BY_PARENT_STEM_NAME";
String parentStemScope="ALL_IN_SUBTREE";
WsStemQueryFilter filter = new WsStemQueryFilter();
filter.setParentStemName(parentStem);
filter.setStemQueryFilterType(queryFilterType);
filter.setParentStemNameScope(parentStemScope);
GcFindStems finder = new GcFindStems();
finder.assignStemQueryFilter(filter);
WsFindStemsResults results = finder.execute();
WsStem[] found=results.getStemResults();
if (found!=null) {
String stemName;
int umlautValue;
for (WsStem s : found) {
stemName=s.getName();
// umlaut is last char and should be 228
umlautValue=stemName.charAt(stemName.length()-1);
System.out.println("Found stem: " + stemName);
System.out.println("Umlaut has value: " + umlautValue);
}
}
}

public static void main(String[] args) throws Exception {
GrouperClientUmlautTest.saveStem("test:umlauts");
GrouperClientUmlautTest.saveStem("test:umlauts:itIs"+(char)228);
GrouperClientUmlautTest.getStems("test:umlauts");
}

}
*** snap ***

This results - for me - in the following output:

Saving stem: test:umlauts
Saving stem: test:umlauts:itIsä
Found stem: test:umlauts:itIs[crudeSign]
Umlaut has value: 65533

This is clearly wrong, since the char's value was set to 228.

Kind regards,

Mirko


Am 14.09.2009 16:39, schrieb Chris Hyzer:
Ok, I think this already works, just need to adjust the encoding of
the terminal. In Putty, and SecureCRT I switched to UTF-8 encoding,
and it works fine. If you see the right result in the web service
response, then you don’t need to upgrade the WS.



[mchyzer@flash
pennGroupsClient-1.4.2]$ java -jar grouperClient.jar
--operation=groupSaveWs --name=aStem:newGroup0ä

Success: T: code: SUCCESS_NO_CHANGES_NEEDED: aStem:newGroup0ä

[mchyzer@flash
pennGroupsClient-1.4.2]$





Btw., the UI displays the umlaut correctly...

<span class="browseStemsLocationHere">[...]umlautä</span>

...but should better escape it (in this case to umlaut&auml; or to

umlaut&#228;).



Good. I think this is easier to do in a UI than a console. But with
the LANG set properly (mine is UTF8), and the terminal encoding set
properly (again UTF8), then I think it is fine.

Ok?



Thanks,

Chris

--
Mirko Tasler
ZE für Datenverarbeitung, Compute- & Medien Service
Freie Universität Berlin



Archive powered by MHonArc 2.6.16.

Top of Page