Loading ...
Sorry, an error occurred while loading the content.
 

Re: if "\xe4"=="\xe4" failes,why?

Expand Messages
  • Charles E Campbell Jr
    ... That s peculiar; I get (when I source the script): equal! 1 with the following emendation to the script: set encoding=utf-8 if xe4 == xe4 redraw!
    Message 1 of 7 , Dec 1, 2006
      A.J.Mechelynck wrote:

      > Charles E Campbell Jr wrote:
      >
      >> mbbill wrote:
      >>
      >>> I met a very strange problem recently, that is
      >>> when I set the following options:
      >>> set encoding=utf-8
      >>> set ignorecase
      >>> then the expression: if "\xe4"=="\xe4" fails.
      >>> I test it using:
      >>> if "\xe4"=="\xe4"
      >>> echo "test"
      >>> endif
      >>> but I got nothing output, why ?
      >>>
      >>>
      >>>
      >>>
      >>>
      >> Try
      >>
      >> set encoding=utf-8
      >> if "\xe4" == "\xe4"
      >> redraw!
      >> echo "equal!"
      >> else
      >> redraw!
      >> echo "not equal"
      >> endif
      >>
      >>
      >> Looks like your message is doing an unwanted disappearing act.
      >>
      >> Regards,
      >> Chip Campbell
      >>
      >>
      >
      > It's not as simple as that, Dr. Chip: I get 0 (zero) as reply to
      >
      > :echo ("\xe4" == "\xe4")
      >
      > when 'encoding' is UTF-8. However, the byte 0xE4 by itself is not a
      > valid character in UTF-8. I also get 1 (one) in reply to
      >
      > :echo ("ä" == "\xc3\xa4")
      >
      > where ä (a-umlaut) is Unicode codepoint U+00E4, represented in UTF-8
      > by the two bytes 0xC3 0xA4.

      That's peculiar; I get (when I source the script):
      equal!
      1

      with the following emendation to the script:

      set encoding=utf-8
      if "\xe4" == "\xe4"
      redraw!
      echo "equal!"
      else
      redraw!
      echo "not equal"
      endif
      echo ("\xe4" == "\xe4")

      But, without those redraws, I get no message.

      Regards,
      Chip Campbell
    • A.J.Mechelynck
      ... [...] ... I still get 0 (and sourcing the above scriptlet gives me not equal 0 ). In some earlier post, the OP mentioned he needed ignorecase to see the
      Message 2 of 7 , Dec 1, 2006
        Charles E Campbell Jr wrote:
        > A.J.Mechelynck wrote:
        [...]
        >> It's not as simple as that, Dr. Chip: I get 0 (zero) as reply to
        >>
        >> :echo ("\xe4" == "\xe4")
        >>
        >> when 'encoding' is UTF-8. However, the byte 0xE4 by itself is not a
        >> valid character in UTF-8. I also get 1 (one) in reply to
        >>
        >> :echo ("ä" == "\xc3\xa4")
        >>
        >> where ä (a-umlaut) is Unicode codepoint U+00E4, represented in UTF-8
        >> by the two bytes 0xC3 0xA4.
        >
        > That's peculiar; I get (when I source the script):
        > equal!
        > 1
        >
        > with the following emendation to the script:
        >
        > set encoding=utf-8
        > if "\xe4" == "\xe4"
        > redraw!
        > echo "equal!"
        > else
        > redraw!
        > echo "not equal"
        > endif
        > echo ("\xe4" == "\xe4")
        >
        > But, without those redraws, I get no message.
        >
        > Regards,
        > Chip Campbell
        >
        >

        I still get 0 (and sourcing the above scriptlet gives me

        not equal
        0

        ). In some earlier post, the OP mentioned he needed 'ignorecase' to see the
        "unequal" behaviour (I have encoding=utf-8 ignorecase as defaults).

        Using gvim 7.0.174, huge version with GTK2-GNOME GUI, on SuSE Linux 9.3


        Best regards,
        Tony.
      Your message has been successfully submitted and would be delivered to recipients shortly.