DHW

_FFXpath returns Chinese string in wrong coding

6 posts in this topic

#1 ·  Posted (edited)

I got problem  retrieving UTF-8 Chinese textcontent from webpage.

<a href="/index/XAU.php">費城金銀</a>
#Include <FF.au3>

_FFConnect()

$sExpect= "費城金銀"    ;the expected result
$sReturn=_FFXPath("//a[@href = '/index/XAU.php']","textContent",2)

msgbox(4096, "", "$sExpect" & @crlf & $sExpect & @crlf & @crlf & _
    "$sReturn" & @crlf & $sReturn & @crlf & @crlf & _
    "binaryToString(stringToBinary($sReturn,1),4)" & @crlf & binarytostring(stringToBinary($sReturn,1),4)& @crlf & @crlf & _    ;convert it back to UTF-8, but only 1 character is correct.
    "binaryToString(stringToBinary(binaryToString(stringToBinary($sExpect,4),1),1),4)" & @crlf & binarytostring(stringtobinary(binarytostring(stringToBinary($sExpect,4),1),1),4))  ;simulate the error.

Does anybody know the way to retrieve textcontent in UTF-8 directly instead of ANSI?

Thanks for your help!

 

Edited by DHW

Share this post


Link to post
Share on other sites



我也遇到这样的问题,不知道怎么解决?会丢失字符,依然有乱码?

Share this post


Link to post
Share on other sites

Please try to stick to English:

Quote

I have encountered this problem, I do not know how to solve? Character is lost, there is still garbled?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

高手都在干嘛,为什么没来解决啊?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

2 hours ago, diandiand163 said:

高手都在干嘛,为什么没来解决啊?

Masters are doing, why not to solve ah?

Sigh .. ENGLISH PLEASE! (请说英语!)

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now