For sake of using SYS(987), try out this:
1. Form with Editbox1 and a text having English and Chinese in it
2. MSSQL table like this:
Code:
CREATE TABLE TestUnicode (
id int IDENTITY(1, 1) NOT NULL primary key,
TextColumn nvarchar(120))
2. Button click code:
Code:
SYS(987,.T.)
AnsiText = Thisform.EditBox1.Value
SQLEXEC(h,"Insert Into TestUnicode (TextColumn) VALUES (?m.AnsiText)")
Where h is the handle you got from SQLStringConnect or SQLConnect. Even better use updatable remote view or cursoradapter and TABLEUPDATE(), but that's for later.
Get back the text with
Code:
SYS(987,.T.)
SQLEXEC(h,"Select TextColumn From TestUnicode","crsSQLResult")
And then browse that cursor or set aneditbox.value to TextColumn.
But also, open up SQL Server Management Studio and list the table there or query Select TextColumn From TestUnicode there and see that you will be able to read the Unicode text there. That's neither possible with base64 encoded text nor with RTF.
You want to be able to search your texts, later with queries like Select TextColumn From TestUnicode WHERE TextColumn LIKE N'%search word (even chinese)%' or other queries. You'll only be able to do so converting to Unicode, nothing else.
You can also do the SYS(987,.T.) once in your start main.prg, it's not necessary to repeat it before every single SQLEXEC, but it does the conversion to and from Unicde automatically, you just have to use parameters in your SQL, not string literals, that won't work out due to several issues of which one is that of string delimiters I talked about in your other thread.
To use RTF you will need to convert Unicode to an RTF file, that's not doable with STRCONV(), indeed VFP has no inbuilt function for that, it's also not just a different character encoding, it's a file format. You can't even expect the RTF Textbox control to display the same ANSI text as a VFP Editbox when you set the Text property instead of TextRTF. If you want to get more than just the limited set of characters available in Ansi codepages VFP can display in its controls, then go for Unicode controls, not the RTF control, that's the wrong choice.
Enabling to use the RTF RichText control is a whole different topic and not done with any simple conversion. I don't think you could get to searchable RTF text and would store RTF in varbinary fields, even though it's kind of a text based encoding like HTML is.