Skip to main content
Inspiring
January 11, 2023

SDK: LrStringUtils is broken (Windows)

  • January 11, 2023
  • 2 replies
  • 769 views

Hi.

I'm writing Ligtroom plugin, and faced the fact that at least LrStringUtils.upper() and LrStringUtils.lower() doesn't work as expected.

For example for LrStringUtils.upper() documentation says:

 

 

 

Converts a string to uppercase using the operating system's localized case conversion. Unlike the Lua string.upper function, this function properly converts characters outside the 7-bit ASCII space.

 

 

 

In practice: it's not any different from the string.upper() - only characters a-z are properly converted to uppercase.

Here is my test code:

 

 

 

local LrDialogs=import("LrDialogs")
local LrStringUtils=import("LrStringUtils")
local s1=tostring(LrStringUtils.upper("ТеСт-TeSt-óó"))
local s2=tostring(LrStringUtils.upper("тЕсТ-tEsT-óó"))
LrDialogs.message(s1..", "..s2..", "..tostring(s1==s2))

 

 

 

The result is

 

 

 

ТеСт-TEST-óó, тЕсТ-TEST-óó, false

 

 

 

As you can see - only latin characters were converted to uppercase.

Tested under Lightroom Classic v12.1, running on Windows 10 x64 22H2

I can't believe such a thing left unnoticed for so long.

So maybe it's just me missing something...

Can someone test this and confirm?

If this is indeed bug - what's the best way to workaround?

Basically I need to compare file system paths in a case-insensitive manner, and can't find a (working) way to do so without calling external utilities via LrTasks.execute()...

This topic has been closed for replies.

2 replies

Rikk Flohr_Photography
Community Manager
January 12, 2023

Adding bug number - setting status

Rikk Flohr: Adobe Photography Org
johnrellis
Legend
January 11, 2023

It appears to be a Windows-only bug.  On Mac LrStringUtils returns the correct result:

 

 

but on Windows it doesn't convert the case of the Cyrillic letters:

 

 

johnrellis
Legend
January 11, 2023

@Rikk Flohr: Photography, please move to Bugs.