jezzzzy Posted January 23, 2007 Share Posted January 23, 2007 Characters like " - " (dash) and " ' " (apostrophe) are getting changed into strange looking characters (image attached). Here is some sample code: ;Write page to temp file $webCode = _INetGetSource($wURL) $file = FileOpen(@TempDir & "\temp.txt",2) FileWrite($file,$webCode) FileClose($file) ;Read contents of file into variables $wTitle = _SRE_Between(StringStripWS(FileRead(@TempDir & "\temp.txt"), 4), '"Title"\>', '\<') ;Put the variables into GUI GUICtrlSetData($lblTitle,($wTitle[0])) If the contents of the HTML between the '"Title"\>' and the '\<' contains quotes, apostrophes, dashes, etc. they get displayed in my gui as strange characters as depicted in the attached .jpg. The .jpg sample character should be a regular dash. Can't figure this one out. If anyone needs me to post the functions, let me know. I'm pretty sure these are widely used and don't need to be included. Any help is appreciated. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 23, 2007 Moderators Share Posted January 23, 2007 Instead of using _SRE_Between(), I re-wrote it, and it's in the standard UDFs in 3.2.2.0 now (Called _StringBetween()). Don't know if that will help you without you providing an actual example, but that's about all the advice I can give for now. (P.S. you don't need to strip the Carriage Returns anymore). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jezzzzy Posted January 24, 2007 Author Share Posted January 24, 2007 Thanks for the input smoke. I have upgraded to .2.2 and will test the new function. I hope it is the function, but I have a feeling that your function is not to blame. I'm working up some further tests to narrow down the cause. Also, you commented about needing an actual example: -- The code that I posted is the actual example. Let me know if you need more of it and I will post. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2007 Moderators Share Posted January 24, 2007 Thanks for the input smoke. I have upgraded to .2.2 and will test the new function. I hope it is the function, but I have a feeling that your function is not to blame. I'm working up some further tests to narrow down the cause. Also, you commented about needing an actual example: -- The code that I posted is the actual example. Let me know if you need more of it and I will post.The code "is" the example?You mean this?;Write page to temp file $webCode = _INetGetSource($wURL) $file = FileOpen(@TempDir & "\temp.txt",2) FileWrite($file,$webCode) FileClose($file) ;Read contents of file into variables $wTitle = _SRE_Between(StringStripWS(FileRead(@TempDir & "\temp.txt"), 4), '"Title"\>', '\<') ;Put the variables into GUI GUICtrlSetData($lblTitle,($wTitle[0]))Um... ... What's $wURL? Just any URL? If that's the case, then I'll guarantee I'll not get the same results as you...I would suggest either posting the URL that's giving you the issues if the new 3.2.2.0 doesn't work for you, or PM someone with it so they can maybe test what is going on if the URL is private. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jezzzzy Posted January 24, 2007 Author Share Posted January 24, 2007 (edited) Here is the complete code for a sample script to demonstrate the problem. ;Includes #include <INet.au3> #include <String.au3> ;Variables $wURL = "http://dilbertblog.typepad.com/" ;Write page to temp file $webCode = _INetGetSource($wURL) ;Read contents of file into variables ;$wTitle = _StringBetween(StringStripWS(FileRead(@TempDir & "\temp2.txt"),4), 'title>', '<') ;Non SRE Version $wTitle = _StringBetween($webCode, 'furry', 'worth',-1,1) ;SRE Version ;Put the variables into GUI If IsArray($wTitle) Then MsgBox(0,"$wTitle - $wTitleNonSRE",StringStripWS($wTitle[0],4)) Else MsgBox(0,"$wTitle - $wTitleNonSRE",$wTitle) EndIf Edit: Took out code that was writing to txt file. Irrelevant for this problem. Edited January 24, 2007 by jezzzzy Link to comment Share on other sites More sharing options...
jezzzzy Posted January 24, 2007 Author Share Posted January 24, 2007 Solution: Convert UTF-8 to ANSI. Thanks. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2007 Moderators Share Posted January 24, 2007 Solution:Convert UTF-8 to ANSI. Thanks.Your welcome... I take it the revised script I sent you worked? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jezzzzy Posted January 25, 2007 Author Share Posted January 25, 2007 Yep. Thought I PMd you.Solution found here for others reading this thread:http://www.autoitscript.com/forum/index.ph...&hl=unicodeThanks again smoke. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now