But plenty of English speakers have files that use them, and work with companies whose names use them.
Sorry, I think you have that the wrong way around. If anything, where a solution works only in English, it’s up to the person posting the solution to note the limitation.
MacScripter is not just about solving a particular user’s problem, but also providing a searchable reference site for other users. They may require some English to read the site, but they should not be required to run English-language systems to use the code.
Language-agnostic code should be welcomed, and preferred where practical.
That said, I’m guessing that the OP does want the final four-letter string limited to the characters A-Z0-9. And I’m not sure either solution posted meets that requirement – one potentially capitalizes accented characters, resulting in characters outside the A-Z range, and the other simply drops them, which is also potentially unsatisfactory.
Here’s an alternative approach that deletes any initial "The ", then uses a transform to convert everything to ASCII equivalents (so é becomes e, for example), then to capitalize and strip anything left not in A-Z0-9:
use AppleScript version "2.5" -- macOS 10.11 or later only
use framework "Foundation"
use scripting additions
cleanTheText("The Éclairs R Us")
on cleanTheText(theText)
set aString to current application's NSString's stringWithString:theText
if aString's hasPrefix:"The " then set aString to aString's substringFromIndex:4
set aString to aString's stringByApplyingTransform:"Any-Latin; ASCII; Upper; [^A-Z0-9] Remove" |reverse|:false
try -- errors if string too short
return text 1 thru 4 of (aString as text)
end try
end cleanTheText