Jukka Pitkänen · May 4, 2021

Problem with ##class(%File).Exists -method and scandinavian characters

Hi! I have a promblem with ##class(%File).Exists -method and scandinavian characters.

Ensemble: Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2018.1.2 (Build 309_5U)

I have a business service (EnsLib.EDI.XML.Service.FileService (charset=binary)) which reads XML-files from the server and transmits those to the business process. BP request class is EnsLib.EDI.XML.Document. In BP I have code block 

 SET SourceConfigName = process.%PrimaryRequestHeader.SourceConfigName
 SET SrcPath = ##class(Ens.Director).GetAdapterSettingValue(SourceConfigName,"FilePath",.tSC)
 SET AttachFileName = request.GetValueAt("/record/documentId",,.status)
 SET FileNameFullPath = SrcPath_AttachFileName

Then there is a IF-block where I check that the file really exists.

It works fine most of the time, but if the FileNameFullPath has scandinavian characters like ä ö å ##class(%File).Exists -method doesn't find it.

IF (##class(%File).Exists(FileNameFullPath))

Has anyone come across with the same problem? Does anyone have a solution for this?

Product version: Ensemble 2018.1
$ZV: 2018.1.2 (Build 309_5U)
0 138
Discussion (2)1
Log in or sign up to continue

According to your $ZV you have a unicode installation, so there should be no problem, neither with skandinavian- nor with other language characters.

Please check your filename string... start a terminal session and then:

zzdump FileNameFullPath

then check, in the same way, the file name in your file system

Problem solved! XML file is UTF-8 and I read attachment file name from there. So I needed to use ZCONVERT function and that resolved this.