Using now:
Code: Select all | Expand
HB_CDPSELECT( "UTF8" )
FW_SetUnicode( .T. )
SetClipboardData( CF_TEXT, "Ärzte" )
cValue := GetClpData( CF_TEXT )
Code: Select all | Expand
Ärzte
Does someone know it, then please give me a hint.
Code: Select all | Expand
HB_CDPSELECT( "UTF8" )
FW_SetUnicode( .T. )
SetClipboardData( CF_TEXT, "Ärzte" )
cValue := GetClpData( CF_TEXT )
Code: Select all | Expand
Ärzte
Code: Select all | Expand
// C:\FWH..\SAMPLES\FROSE3UT.PRG
#include "FiveWin.ch"
REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850
static oWnd
FUNCTION Main()
LOCAL oBar
// Germany?
HB_LANGSELECT( 'PT' ) // Default language is now Portuguese
HB_SETCODEPAGE( "PT850" )
FW_SetUnicode( .T. )
// Harbour (not xHarbour) to display unicode filenames
HB_SETCODEPAGE( "UTF8" ) // ???
// HB_CDPSELECT( "UTF8" )
DEFINE WINDOW oWnd TITLE "3D objects"
DEFINE BUTTONBAR oBar _3D OF oWnd
DEFINE BUTTON OF oBar ACTION BuildClip()
SET MESSAGE OF oWnd TO "3D Objects" NOINSET CLOCK DATE KEYBOARD
ACTIVATE WINDOW oWnd
RETURN NIL
FUNCTION BuildClip()
LOCAL cList := ""
LOCAL cText := "Ärzte"
LOCAL oClp
// Open Editor and CTRL+V
DEFINE CLIPBOARD oClp OF oWnd
oClp:SetText( cText )
oClp:End()
IF IsUtf8( cText ) // No comprendo. No funciona.
? cText
ELSE
QUIT
ENDIF
RETURN NIL
// fin / end
Code: Select all | Expand
if !Empty( uData ) .and. IsTextUnicode( uData )
Code: Select all | Expand
if !Empty( uData )
Code: Select all | Expand
#include "fivewin.ch"
function Main()
local cText, cPaste
FW_SetUnicode( .T. )
cText := "Ärzte"
FW_CopyToClipBoard( cText )
? "Copied to ClipBoard " + cText
cPaste := FW_GetClipboardData()
? "Copied : " + cText, "Pasted : " + cPaste, ;
"Compare",cText == cPaste
return nil
try thisfrose wrote:wondering how to set the clipboard data to UTF-8.
Using now:
Does someone know it, then please give me a hint.
Code: Select all | Expand
#include "Fivewin.ch"
#define CF_TEXT 1
#define CF_UNICODETEXT 13
PROCEDURE MAIN
LOCAL cValue := "Hello"
HB_CDPSELECT( "UTF8" )
FW_SetUnicode( .T. )
* SetClipboardData( CF_TEXT , "Ärzte" )
CopyToClipboard( "Ärzte" )
* ? cValue := GetClpData(CF_TEXT)
? cValue := TextFromClipboard()
RETURN
Code: Select all | Expand
FUNCTION CopyToClipboard( cText )
LOCAL oClip := TClipBoard() :New()
IF oClip:Open()
oClip:SetText( cText )
oClip:Close()
ENDIF
oClip:End()
RETURN nil
Code: Select all | Expand
FUNCTION TextFromClipboard()
LOCAL cText := ""
LOCAL oClip := TClipBoard() :New()
IF oClip:Open()
cText := oClip:GetText()
oClip:Close()
IF CRLF $ cText
cText := TRIM( STRTRAN( cText, CRLF, "" ) )
ENDIF
ENDIF
oClip:End()
RETURN cText
Almost ok:nageswaragunupudi wrote:Can you make a small bugfix...
Code: Select all | Expand
Ágota Kristóf
ängstlichen
Ärzte
Åsa Böker
Íngrid Betancourt
Ñejo
Ólafur Arnalds
Ölsardinen
Øresund Space Collective
überbewertet
Überblick
Анастасия Варнавская
벤자민 (Benzamin)
수지 Suzy
Hex codes:
C3 81 67 6F 74 61 20 4B 72 69 73 74 C3 B3 66 0D 0A C3 A4 6E 67 73 74 6C 69 63 68 65 6E 0D 0A C3 84 72 7A 74 65 0D 0A C3 85 73 61 20 42 C3 B6 6B 65 72 0D 0A C3 8D 6E 67 72 69 64 20 42 65 74 61 6E 63 6F 75 72 74 0D 0A C3 91 65 6A 6F 0D 0A C3 93 6C 61 66 75 72 20 41 72 6E 61 6C 64 73 0D 0A C3 96 6C 73 61 72 64 69 6E 65 6E 0D 0A C3 98 72 65 73 75 6E 64 20 53 70 61 63 65 20 43 6F 6C 6C 65 63 74 69 76 65 0D 0A C3 BC 62 65 72 62 65 77 65 72 74 65 74 0D 0A C3 9C 62 65 72 62 6C 69 63 6B 0D 0A D0 90 D0 BD D0 B0 D1 81 D1 82 D0 B0 D1 81 D0 B8 D1 8F 20 D0 92 D0 B0 D1 80 D0 BD D0 B0 D0 B2 D1 81 D0 BA D0 B0 D1 8F 0D 0A EB B2 A4 EC 9E 90 EB AF BC 20 28 42 65 6E 7A 61 6D 69 6E 29 0D 0A EC 88 98 EC A7 80 20 53 75 7A 79
Code: Select all | Expand
Þráinn Bertelsson
Hex codes:
C3 9E 72 E1 69 6E 6E 20 42 65 72 74 65 6C 73 73 6F 6E
Code: Select all | Expand
벤자민 (Benzamin)
Анастасия Варнавская
Hex codes:
EB B2 A4 EC 9E 90 EB AF BC 20 28 42 65 6E 7A 61 6D 69 6E 29 0D 0A D0 90 D0 BD D0 B0 D1 81 D1 82 D0 B0 D1 81 D0 B8 D1 8F 20 D0 92 D0 B0 D1 80 D0 BD D0 B0 D0 B2 D1 81 D0 BA D0 B0 D1 8F
Code: Select all | Expand
Þráinn Bertelsson
ÐнаÑтаÑÐ¸Ñ Ð’Ð°Ñ€Ð½Ð°Ð²ÑкаÑ
벤ìžë¯¼ (Benzamin)
Hex codes:
C3 9E 72 E1 69 6E 6E 20 42 65 72 74 65 6C 73 73 6F 6E 0D 0A D0 90 D0 BD D0 B0 D1 81 D1 82 D0 B0 D1 81 D0 B8 D1 8F 20 D0 92 D0 B0 D1 80 D0 BD D0 B0 D0 B2 D1 81 D0 BA D0 B0 D1 8F 0D 0A EB B2 A4 EC 9E 90 EB AF BC 20 28 42 65 6E 7A 61 6D 69 6E 29
Code: Select all | Expand
Thráinn Bertelsson
Hex codes:
54 68 72 C3 A1 69 6E 6E 20 42 65 72 74 65 6C 73 73 6F 6E
Code: Select all | Expand
Þráinn Bertelsson
Hex codes:
DE 72 E1 69 6E 6E 20 42 65 72 74 65 6C 73 73 6F 6E
Code: Select all | Expand
Þráinn Bertelsson
Thráinn Bertelsson
Thrainn Bertelsson
Hex codes:
DE 72 E1 69 6E 6E 20 42 65 72 74 65 6C 73 73 6F 6E 0D 0A 54 68 72 C3 A1 69 6E 6E 20 42 65 72 74 65 6C 73 73 6F 6E 0D 0A 54 68 72 61 69 6E 6E 20 42 65 72 74 65 6C 73 73 6F 6E
Code: Select all | Expand
#include "fivewin.ch"
function main()
local cText, cPaste
local aText[ 4 ]
FW_SetUnicode( .t. )
TEXT INTO aText[ 1 ]
Ágota Kristóf
ängstlichen
Ärzte
Åsa Böker
Íngrid Betancourt
Ñejo
Ólafur Arnalds
Ölsardinen
Øresund Space Collective
überbewertet
Überblick
Анастасия Варнавская
벤자민 (Benzamin)
수지 Suzy
ENDTEXT
aText[ 2 ] := "Þráinn Bertelsson"
TEXT INTO aText[ 3 ]
벤자민 (Benzamin)
Анастасия Варнавская
ENDTEXT
TEXT INTO aText[ 4 ]
Þráinn Bertelsson
ÐнаÑтаÑÐ¸Ñ Ð’Ð°Ñ€Ð½Ð°Ð²ÑкаÑ
벤ìžë¯¼ (Benzamin)
ENDTEXT
FOR EACH cText IN aText
FW_CopyToClipBoard( cText )
cPaste := FW_GetClipBoardData()
? "Original Text :" + CRLF + ;
cText + CRLF + ;
"Pasted from Clipboard :" + ;
cPaste + CRLF + ;
"Compare : " + ;
If( cText == cPaste, "EXACTLY EQUAL", "Diiferent" )
NEXT
return nil
// USE THESE CLIPBOARD FUNCTIONS ONLY
static function FW_CopyToClipBoard( uValue, nFormat )
local lCopied := .f.
if HB_ISPOINTER( uValue ) // assumes GDI+ Image object
GDIPLUSImageToClipBoard( uValue )
return .t.
endif
if uValue != nil
if Empty( nFormat ) .and. HB_ISARRAY( uValue ) .and. ;
AScan( uValue, { |u| ValType( u ) != "C" } ) == 0
nFormat := 15
endif
DEFAULT nFormat := If( HB_ISSTRING( uValue ), 1, ;
If( HB_ISNUMERIC( uValue ) .and. ISHBITMAP( uValue ), 2, nil ) )
if Empty( nFormat )
if ValType( uValue ) $ "AH"
uValue := FW_ValToExp( uValue )
else
uValue := cValToChar( uValue )
endif
nFormat := 1
endif
if nFormat != nil
if OpenClipBoard( GetDeskTopWindow() )
EmptyClipboard()
if nFormat == 1 .and. IsUtf8( uValue )
uValue := utf8toutf16( uValue )
if !( Right( uValue, 2 ) == Chr( 0 ) + Chr( 0 ) )
uValue += ( Chr( 0 ) + Chr( 0 ) )
endif
lCopied := SetClipboardData( 13, uValue )
elseif nFormat == 15
if !HB_ISARRAY( uValue )
uValue := { uValue }
endif
lCopied := SetClipboardData( 15, uValue )
else
lCopied := SetClipboardData( nFormat, uValue )
endif
CloseClipboard()
endif
endif
endif
return lCopied
//----------------------------------------------------------------------------//
static function FW_GetClipBoardData( nFormat ) // [@nFormat]
local uData, lCopied
if nFormat == 3; nFormat := 14; endif
if !Empty( nFormat := GetClipContentFormat( nFormat ) )
if OpenClipBoard( GetDeskTopWindow() )
uData := GetClpData( nFormat )
EmptyClipboard()
CloseClipboard()
endif
endif
do case
case nFormat == 15 // CF_HDROP
uData := If( Empty( uData ), {}, DragQueryFiles( uData ) )
case nFormat == 13 // CF_UNICODETEXT
if !Empty( uData ) //.and. IsTextUnicode( uData )
uData := UTF16TOUTF8( uData )
endif
endcase
return uData
//----------------------------------------------------------------------------//
Mr. Rao,nageswaragunupudi wrote: Second line not copied correctly.
What is happening?
nageswaragunupudi wrote:May I know how were you deriving those hex codes?
Code: Select all | Expand
StrToHex( cVar1, " " )
Yes all compares are 'exactly equal', so that we can assume, that the clipboard runs well under UTF-8nageswaragunupudi wrote:Please run this program as it is:
...
From now onwards, please use the above two functions.frose wrote:Yes all compares are 'exactly equal', so that we can assume, that the clipboard runs well under UTF-8nageswaragunupudi wrote:Please run this program as it is:
...
Have cleaned up the source code, now it worksfrose wrote:Mr. Rao,nageswaragunupudi wrote: Second line not copied correctly.
What is happening?
yes, it must be something if the values are extracted from a TXBrowse!
I will explore this and come back to it.