Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: avoid writing 'use utf8' in every script

by reqnode (Novice)
on Feb 03, 2014 at 16:27 UTC ( #1073227=note: print w/ replies, xml ) Need Help??


in reply to Re: avoid writing 'use utf8' in every script
in thread avoid writing 'use utf8' in every script

I am old jerk and love creating programs with less code possible to run on 2 MB RAM


Comment on Re^2: avoid writing 'use utf8' in every script
Re^3: avoid writing 'use utf8' in every script
by hdb (Prior) on Feb 03, 2014 at 16:33 UTC

    That is a sentiment I have a lot of sympathy for, but then, would it not be better to stick to ASCII (7 bits)?

      No, my boss requires every source code to be strictly in japanese
        No, my boss requires every source code to be strictly in japanese

        Does your boss also require that all source code files be strictly in a single character encoding scheme of the Unicode coded character set? If she doesn't, she should. In the case of computer programs, the character encoding of the source code file is as important to the computer as the natural language is to the programmer (and to the programmer's boss).

        Think of your problem as two-fold. Firstly, you have a text file character encoding conformance problem. What do you do in your programming environment to ensure that all source code files for all projects are in the same coded character set (e.g., Unicode) and character encoding scheme (e.g., UTF-8)? What discipline do you impose on your programming team to ensure that, for example, no programmer inadvertently creates a source code file in the Shift-JIS character encoding? You should apply some rigor to enforcing that all source code files are in the UTF-8 CES of the Unicode CCS, and that they always include the Unicode byte order mark in them.

        Secondly, you have a Perl multiple source code file inclusion la do() problem. But when you've solved the first, more fundamental character encoding conformance problem in the way I've suggested, you've also solved this second, more coincidental problem.

        (N.B. The memory footprint of the Unicode byte order mark is quite small.)

        Jim

Re^3: avoid writing 'use utf8' in every script
by ikegami (Pope) on Feb 03, 2014 at 17:33 UTC

    use utf8; does not use result in any code.

    >perl -MO=Concise,-exec -e"use utf8; $x='abc';" 1 <0> enter 2 <;> nextstate(main 7 -e:1) v:U,{ 3 <$> const[PV "abc"] s 4 <#> gvsv[*x] s 5 <2> sassign vKS/2 6 <@> leave[1 ref] vKP/REFC -e syntax OK

    It has a compile-time effect.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1073227]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2014-10-26 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (152 votes), past polls