Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Whatsapp unicode
Message
De
01/11/2020 04:48:38
 
 
À
01/11/2020 03:25:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Divers
Thread ID:
01676908
Message ID:
01676911
Vues:
42
J'aime (1)
Tariq,

That would be STRCONV(m.cMessage, 9) to give you the UTF-8 rendering of the text, but you'll eventually need to play with the function's regional identifier argument to adjust to the regional settings in your system.

After the text is encoded as UTF-8, you should URL encode the result before adding it to the command. You can easily find URL encoders in VFP out there, such as this:
FUNCTION URLEncode (Text AS String, UTF8 AS Boolean) AS String

	LOCAL OriginalText AS String
	LOCAL Encoded AS String
	LOCAL CharIndex AS Integer
	LOCAL CharAt AS Character
	
	IF m.UTF8
		m.OriginalText = STRCONV(STRCONV(m.Text,1),9)
	ELSE
		m.OriginalText = m.Text
	ENDIF

	m.Encoded = ""
	FOR m.CharIndex = 1 TO LEN(m.OriginalText)
	
		m.CharAt = SUBSTR(m.OriginalText,m.CharIndex,1)
		
		IF m.CharAt $ ":/?#[]@!$&'()*+,;=%" OR !BETWEEN(ASC(m.CharAt), 33, 127)
			m.CharAt = "%" + STRCONV(m.CharAt,15)
		ENDIF
		
		m.Encoded = m.Encoded + m.CharAt
	
	ENDFOR
	
	RETURN m.Encoded
ENDFUNC
<pre>


>Sir you mean should I use like this
>
><pre>
>cMessage=STRCONV(cMessage,8,1056)
>cmd='whatsapp://send?phone=&cPhone&text=&cMessage'
>
>
>Languages
>https://docs.microsoft.com/en-us/previous-versions/windows/embedded/ms912047(v=winembedded.10)?redirectedfrom=MSDN
>
>
>
>
>
>>Tariq,
>>
>>Try to STRCONV() the Urdu text into UTF-8, and I would also advise to URLEncode the resulting text (that goes also to the English messages).
>>
>>>Dear Experts
>>>
>>>I am using these codes to send messages on whatsapp
>>>
>>>
>>>Declare  Integer FindWindow In WIN32API String , String
>>>Declare  Integer SetForegroundWindow In WIN32API Integer
>>>Declare  Integer  ShowWindow  In WIN32API Integer , Integer
>>>Declare Integer ShellExecute In shell32.Dll ;
>>>	INTEGER hndWin, ;
>>>	STRING cAction, ;
>>>	STRING cFileName, ;
>>>	STRING cParams, ;
>>>	STRING cDir, ;
>>>	INTEGER nShowWin
>>>
>>>Local lt, lhwnd
>>>
>>>cPhone=[923000000000]
>>>
>>>cMessage=[How are you sir?]
>>>
>>>cmd='whatsapp://send?phone=&cPhone&text=&cMessage'
>>>
>>>=ShellExecute(0, 'open', cmd,'', '', 1)
>>>
>>>Wait "" Timeout 3
>>>lt = "Whatsapp"
>>>lhwnd = FindWindow (0, lt)
>>>If lhwnd!= 0 					
>>>	SetForegroundWindow (lhwnd) 
>>>	ShowWindow (lhwnd, 1)
>>>	ox = Createobject ( "Wscript.Shell" )
>>>	ox.sendKeys ( '{ENTER}' )
>>>	*Messagebox ( "Message Sent" )
>>>Else
>>>	Messagebox ( "Whatsapp no activada!" )
>>>Endif
>>>
>>>
>>>The codes work fine, no issue.
>>>Message are delivered properly.
>>>
>>>But.... only English messages
>>>
>>>When I try to send message in a language other than English suppose Urdu like this
>>>
>>>
>>>cMessage=[آپ کیسے ہییں آپ کا آج کا کیا پروگرام ہے؟]
>>>
>>>
>>>Then I have to face this error message
>>>unrecognized command verb
>>>
>>>My question is how to pass unicode characters in this string
>>>
>>>cmd='whatsapp://send?phone=&cPhone&text=&cMessage'
>>>
>>>
>>>Please help me to prepare above message to send whatsapp.
>>>
>>>Regards
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform