in reply to Unrecognized character in source code

The OS I use is windows 2000 professional and the cpu is AMD Athlon XP 2000+.My native laguage is Chinese,but I write it in English.Most of all,the line2 and line4 in my document is equals sign.And I run it in the Activeperl,I edit it in the notepad.
  • Comment on Re: Unrecognized character in source code

Replies are listed 'Best First'.
Re^2: Unrecognized character in source code
by shenme (Priest) on Oct 10, 2004 at 03:10 UTC
    It looks like the value pasted into your posting was UTF-8 C3 82 C2 81, which converts to Unicode 81C2, which doesn't make sense as that is in the middle of the Unicode CJK characters.

    Please tell us what font you have selected. And do you have one of the Chinese IME's active? And is the source file Unicode encoded?

    Unfortunately, Unicode has more characters than anyone can handle. Lots of characters can look the same. If I use the WinXP character map program to search for "equals" it shows three different characters:
        U+003D = = Normal equal sign
        U+FF1D = = Fullwidth equals sign
        U+F366 ﹦ ﹦ Small equal sign
    Only the first of these is what Perl will understand.

    A couple more characters that look somewhat similar are:
        U+2550 ═ ═ Box Drawings Double Horizontal
        U+3013 〓 〓 Geta Mark

    And I played around a bit and found that Windows will freely convert the fullwidth equals to a normal equals. But Perl will continue to see them as different.

    Anyway, check what font you are using, and perhaps save the source once as non-Unicode text? (File / SaveAs / Set Encoding to 'ANSI' ) 行 不 行 吗 ?

      I save the source as non-Unicode text,just as you say,the text save as ANSI type,the font I use is Fixedsys
        It sounds like you are running in circles because windows has some loosely (un)coupled things all going on that contribute to you getting different codes from what you want.

        I didn't hear what kind of text editor you are using but I guess it is something running on windows, subject to all kinds of windows front-end processing and maybe munging of the clipboard even.

        I think if you can deal with it, you will be a lot happier if you use a programmer's editor, best would be vim or xemacs. With XEmacs I would recommend installing it from within cygwin along with X. When you type startx you will get a nice scrollable shell and then type xemacs and you get a nice multi-encoding programmable editor. (I don't think it has unicode though someone tell me). I just tried XEmacs the windows version on win98 and it suddenly forgot how to do ediff (file comparison) but maybe you will like it. Anyway, I almost always use XEmacs on linux and generally have been able to deal with files in other encodings people throw at me easily (set buffer encoding in the Mule system multilingual menu).

        Anyway I know it is possible to program in windows having used codewarrior a bunch some time ago, but even now doing wxperl I feel like someone is tying me up in ropes unless I use unix tools. Hope you solve the problem, you might like to post to a Chinese mailing list.