Just got a message from the office and free wifi in Tampa is awful so I don't expect to be able to dig out the answer.
Point 1, though, OemToUtf16Buffer isn't in the help but OemToUtf8Buffer is.
below is updated
...
Dave,
I keep getting illegal datatype conversion error when I run RprNightBreit2. The function that gives me the error is in the screenshot below. It is in CharTranslate.pkg.
Code:
//Converts a OEM string to UTF-16
//pOemBuf = Pointer to OEM string
//iLen = Length of OEM string in bytes
//Returns pointer to UTF-16 string, use free() to deallocate buffer when it's no longer needed
Function OemToUtf16Buffer Global Pointer pOemBuf Integer iLen Returns Pointer
Pointer pWideBuf
Integer iWideBufLen
Move 0 to pWideBuf
Move (MultiToWideBuffer(CP_OEMCP,pOemBuf,iLen,AddressOf(pWideBuf))) to iWideBufLen
If (iWideBufLen=0) Begin
Function_Return 0
End
Function_Return pWideBuf
End_Function
called from
Code:
Function OemToUtf16String Global String sSource Integer iBlockUTF16 Returns String //Will's version
String sDestination
Address pDest pConverted
Boolean bVoid
ZeroString 2 to sDestination //was 2048
Move (AddressOf(sDestination)) to pDest
Move (OemToUtf16Buffer(AddressOf(sSource), CStringLength(sSource))) to pConverted
Move (MemCopy(pDest,pConverted,iBlockUTF16)) to bVoid //was 2048
If (not(bVoid)) Begin
Showln "failed to convert " sSource
End
Move (Free(pConverted)) to bVoid
Function_Return sDestination
End_Function
and OEMtoUTF16String is called from the StartReport
Code:
Move 0 to icount
Direct_Input channel 8 sFile //reopen ascii workfile
Repeat
ZeroString 1 to sLineIn
ZeroString 1 to sLineOut
Read_Block channel 8 sLineIn 1 //iBlockASCII
Increment iCount
If (sLIneIn<>sNUL) Begin
Move (OemToUtf16string(sLineIn, 1)) to sLineOut
Get BinaryFileWrite of oFilesystem iFile (&sLineOut) to bVoid
If (not(bVoid)) Begin
Send UserError ("Write failed at character #" *(String(icount)))
Procedure_Return
End
End
Until (sLIneIn=sEOF or sLIneIn=sNUL)
D