• [^] # Re: Unicode

    Posté par (site web personnel) . En réponse au journal Des emojis en SQL ? C'est possible... et on peut aller au-delà !. Évalué à 6.

    $ python
    Python 2.7.16 (default, Mar 4 2019, 15:29:09) 
    [GCC 8.3.0] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 🐧=42
     File "<stdin>", line 1
     🐧=42
     ^
    SyntaxError: invalid syntax
    $ python3
    Python 3.7.2+ (default, Feb 27 2019, 15:41:59) 
    [GCC 8.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 🐧=42
     File "<stdin>", line 1
     🐧=42
     ^
    SyntaxError: invalid character in identifier
    $ export 🐧=42
    bash: export: « 🐧=42 » : identifiant non valable
    $ cat main.c
    int main() {
     int 🐧=42;
     return 🐧;
    }
    $ gcc --version
    gcc (Debian 8.3.0-2) 8.3.0
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    $ gcc main.c 
    main.c: In function ‘main’:
    main.c:2:6: error: stray ‘360円’ in program
     int ����=42;
     ^
    main.c:2:7: error: stray ‘237円’ in program
     int ����=42;
     ^
    main.c:2:8: error: stray ‘220円’ in program
     int ���=42;
     ^
    main.c:2:9: error: stray ‘247円’ in program
     int ��=42;
     ^
    main.c:2:10: error: expected identifier or ‘(’ before ‘=’ token
     int 🐧=42;
     ^
    main.c:3:9: error: stray ‘360円’ in program
     return ����;
     ^
    main.c:3:10: error: stray ‘237円’ in program
     return ����;
     ^
    main.c:3:11: error: stray ‘220円’ in program
     return ���;
     ^
    main.c:3:12: error: stray ‘247円’ in program
     return ��;
     ^
    main.c:3:2: warning: ‘return’ with no value, in function returning non-void
     return 🐧;
     ^~~~~~
    main.c:1:5: note: declared here
     int main() {
     ^~~~
    $ ruby --version
    ruby 2.5.3p105 (2018年10月18日 revision 65156) [x86_64-linux-gnu]
    $ irb
    irb(main):001:0> 🐧=42
    => 42
    irb(main):002:0> print 🐧
    42=> nil
    $ cat t.pl 
    my $🐧=42;
    print $🐧;
    $ perl --version
    This is perl 5, version 28, subversion 1 (v5.28.1) built for x86_64-linux-gnu-thread-multi
    (with 59 registered patches, see perl -V for more detail)
    (...)
    $ perl t.pl 
    Can't use global $� in "my" at t.pl line 1, near "my $�"
    Unrecognized character \x9F; marked by <-- HERE after my $�<-- HERE near column 6 at t.pl line 1.