Converts a blob containing a Unicode character string to a string in the file format of the current version of PocketBuilder.
FromUnicode ( blob )
Argument |
Description |
---|---|
blob |
A blob containing a Unicode character string you want to convert to a string in the file format of the current version of PocketBuilder |
String. Returns a character string if it succeeds and an empty string if it fails.
The FromUnicode function converts a Unicode blob to a Unicode character string and has the same result as String(blob). This function will be obsolete in a future release of PocketBuilder.
Unicode file format Unicode files sometimes have two extra bytes at the start of the file to indicate that they are Unicode files. If the two bytes are missing, PocketBuilder assumes “little endian” format. If you are opening a Unicode file in stream mode, skip the first two bytes if they are present.
This example converts a Unicode blob that contains the definition of a window into a Unicode string.
integer li_fileone, li_filetwo
blob lb_text
string ls_native
li_fileone = FileOpen("D:\tst\w_one.srw", StreamMode!)
// Move the file pointer so that Unicode
// identifying characters aren't copied
FileSeek(li_Fileone, 2)
// Read the data in the file into a blob
FileRead(li_fileone, lb_text)
FileClose(li_fileone)
// Convert the Unicode blob to a string
ls_native = FromUnicode(lb_text)
// Open a second file to copy the string to
li_filetwo = FileOpen("w_one.srw", &
StreamMode!, Write!)
FileWrite(li_filetwo, ls_native)
FileClose(li_filetwo)