Can't get material name "Grasgrün" on release mode when locale is set into Japanese

Hi Experts,

In the attached model, there is a material with the name “Grasgrün”. I can read the name “Grasgrün” from the function SUMaterialGetNameLegacyBehavior(…) on debug environment when locale is “japanese”. Please see my test codes below.

    SUStringRef name;
    SUSetInvalid( name );
    SUStringCreate( &name );
    if ( SU_ERROR_NONE == SUMaterialGetNameLegacyBehavior( material, &name ) ) 
    {

        // get UTF-8 string length
        size_t length;
        SUStringGetUTF8Length( name, &length );

        // convert SUStringRef to UTF-8 string
        char* string = new char[length + 1];
        size_t returned_length;
        SUStringGetUTF8( name, length, string, &returned_length );
        string[length] = '\0';

        // free temp variable
        delete[] string;
    }

However, on release environment and locale is Japanese, when I try to get material name by the function SUMaterialGetNameLegacyBehavior(…), the returned result is SU_ERROR_NONE. When I try to get name length further by the function SUStringGetUTF8Length(…), it tells me that the material name length is 0.

Could you please take a look at the material name issue on release environment when locale is Japanese.

It is a model.
SU_V4_Frankenturm.skp (2.2 MB)

I copied this over to our GitHub issue tracker: Can’t get material name “Grasgrün” on release mode when locale is set into Japanese · Issue #182 · SketchUp/api-issue-tracker · GitHub
Can you go there and add some more information;

  1. What OS are you observing this on?
  2. What version of the SketchUp SDK?
  3. Do you see the same when using SUMaterialGetName?

(Please respond in the GitHub ticket.)

  1. Post a screenshot of how your locale settings are set to reproduce this.

I add the information to GitHub issue tracker. Please let me know if these information are not enough.

1 Like

Thank you. It’s on our triage list. (We’ve been very busy these last couple of weeks I’m afraid.)