Archived Forum Post

Index of archived forum posts

Question:

Why does CkCertStore::ckLastErrorText only contain a single letter?

Aug 25 '15 at 22:24

I am trying to open a certificate store using the following command in Purebasic. It fails but when I check the log all I see is a single "C" for the last error text. It is the same when I use the debug command to display the last error text. I am using Windows 10 and Purebasic 5.32(x64). I am able to open the certificale store using Portecle so the certificate store is not corrupt and the password is correct.

loCertStore = CkCertStore::ckCreate()
If CkCertStore::ckLoadPfxFile(loCertStore,"kfs.pfx",#dCCertStorePwd) = 0
   WriteToLog("CkCertStore::ckLoadPfxFile("+CkCertStore::ckLastErrorText(loCertStore)+")")
   CkCertStore::ckDispose(loCertStore)
EndIf

Accepted Answer

Chilkat returns Unicode strings, so that means PureBasic apps using Chilkat should be compiled in Unicode Mode.

To check if the program is compiled in "Unicode mode", you can use the compiler directives with #PB_Compiler_Unicode constant. To compile a program in "Unicode mode" the related option can be set in the Compiler options.

A telltale sign of having Unicode but interpreting the bytes as ANSI (one byte per char), is that you see the 1st char but the 2nd byte of the Unicode (utf-16) is 0, and this is taken as the terminating null of an ANSI string.