Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] TR : [Grouper API] problem with special characters in displayName

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] TR : [Grouper API] problem with special characters in displayName

Chronological Thread 
  • From: Chris Hyzer <>
  • To: Nicolas Forney <>, "" <>
  • Subject: RE: [grouper-users] TR : [Grouper API] problem with special characters in displayName
  • Date: Fri, 14 Jun 2013 14:33:07 +0000
  • Accept-language: en-US
  • Authentication-results:; dkim=neutral (message not signed) header.i=none

Grouper does not convert any characters, but the problem is the database requires multiple chars to store non empty chars.  So, the algorithm I use which is safe, and any non-ascii char we count as 3 J  So you can truncate that way…  Here is the method I use when doing the calculation:



   * find the length of ascii chars (non ascii are counted as three)

   * @param input is the string to operate on

   * @param requiredLength length we need the string to be

   * @return the length of ascii chars


  public static String truncateAscii(String input, int requiredLength) {

    if (input == null) {

      return input;


    //see what real length is

    int utfLength = input.length();


    //see if not worth checking

    if (utfLength * 2 < requiredLength) {

      return input;



    //count how many non asciis

    int asciiLength = 0;

    for (int i=0;i<utfLength;i++) {




      //keep count of non ascii chars

      if (!isAscii(input.charAt(i))) {




      //see if we are over

      if (asciiLength > requiredLength) {

        //do not include the current char

        return input.substring(0,i);



    //must have fit

    return input;




From: [mailto:] On Behalf Of Nicolas Forney
Sent: Friday, June 14, 2013 6:44 AM
Subject: [grouper-users] TR : [Grouper API] problem with special characters in displayName




I use the Grouper client API from a java application and I have encountered a problem when trying to create a stem with a large displayName containing multiple special chars (à, è, ô, ü, /, etc.).


Before creating the stem I truncate the displayName variable to 255 and then I set the stem's displayExtension and Extension.

When the webservice request is executed, the webservice return an Interal server error (500) which indicates the displayName is to long.


As the displayName has been truncated before executing the webservice the problem probably come from the special characters conversion which is done by the webservice (a special chat may be represented with more than one char). So I'd like to know how the special characters are converted (with which format?). If I know the format I should be able to know exactly how many characters must be truncated before calling the webservice.


The stacktrace shows the following error (raised by the Oracle Dirver) :

Caused by: java.sql.SQLException: ORA-12899: value too large for column "GROUPER_213"."GROUPER_STEMS"."DISPLAY_NAME" (actual: 266, maximum: 255)



I joined the full stacktrace to this mail.



Thank you in advance for your help.



Archive powered by MHonArc 2.6.16.

Top of Page