CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2009
    Posts
    39

    string comparing

    i am using vista english edition
    i have a chinese file my friend sent me
    i open it with notepad and turn of search string capability, it can read in the odd chinese characters and search correctly the occurences of the pattern given in the "find:textbox"
    i don't know how my browser (ie english edition) can do that

    how can i write a function to search a chinese pattern in a web page content ?
    can you offer me the code you wrote for ie browser ?

    thanks

  2. #2
    Join Date
    Jul 2009
    Posts
    45

    Re: string comparing

    Can you use CString class or wstring of STD (nah-not that abrieviation but I do sometimes consider Std is just that sort of shortened form) ?

    You read the content into a string then use Find to search for the pattern

  3. #3
    Join Date
    Oct 2009
    Posts
    39

    Re: string comparing

    thank you but can you post/give me the source code ?
    it doesn't seem people are willing to help me

  4. #4
    Join Date
    Jun 2009
    Location
    oklahoma
    Posts
    199

    Re: string comparing

    He doesn't seem like you are willing to help yourself.

  5. #5
    Join Date
    Oct 2009
    Posts
    12

    Re: string comparing

    Yes, helping yourself first before asking us to help you, this is the first step towards IT industry and the Standards

  6. #6
    Join Date
    Oct 2009
    Posts
    39

    Re: string comparing

    Quote Originally Posted by jnmacd View Post
    He doesn't seem like you are willing to help yourself.
    thank you
    that is dependent, if you wish to tell me that, and i like to depend on people like you now right now, really love to be dependent, please let me cling on you, stick with you and grab you tighter for now and for always....

    so can you please show me what such a dependent part offers me as a solution to the problem i am having ?
    i would like to read a music lyrics website that is encoded in Spainish

  7. #7
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: string comparing

    It shouldn't matter what language the webpage is in.

    You need to load the page using the right encoding the page was made in. And you should store this in a format that preserves the semantic value of the encoding. You then use a search that's compatible with the storage format used.

    Sounds hard ? it isn't.


    The page has chinese... This means it is encoded in some kind of format, chinese webpages are usually encoded as UTF-16. But it could be another format, you need to KNOW/DETERMINE which this format is.

    You then load the page and convert it to what you're using in your program, and you need to preserve the chinese characters. Meaning... if you have an ansi program, it probably won't work as when converting your UTF-16 with chinese characters to ansi, it won't be able to convert the chinese characters. A good plan would be to create your program as unicode.

    You then do the same with the string you want to find, you need to also get it in unicode format.

    If you have both the text and the search string in unicode. you can use wcsstr() to see if the page contains the string you seek.

  8. #8
    Join Date
    Oct 2009
    Posts
    39

    Re: string comparing

    but after i read the page in to edit some parts then the writing back becomes tricky and flawful

    since the new webpage's not as previously encoded anymore, all the characters become 2 byte encoded.
    i say "all" because even the ascii's characters are reencoded, which is completely wrong. this is why i ask for the offerings of any code piece from people.

    but at the same time i think their intention is to use codesnips as part of micosoft trade or to show off infront of colleagues that they know the problems and they actually code better, nyew nuew nyee nee

    thank anyway, sure i am going to give up in despair as expected and to me it is always "its better NEVER than late". timing needs to be obeyed, punctuality is one of the best features to earn creditability. i am late to complete my application therefore i waste time of many others.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured