Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by Jim (Curate)
on Feb 03, 2014 at 20:56 UTC ( [id://1073265]=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^6: avoid writing 'use utf8' in every script
by reqnode (Novice) on Feb 04, 2014 at 03:35 UTC
    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 ... ?

    Code editor is set to utf-8 without BOM by default, so it's no problem. OS environment is set to UTF-8 also.

        Have you tried to run source code in UTF8 with BOM at perl under windows? It will not run, even with use utf8 stuff;
        It runs OK under *nix environments.
        So, solution is using UTF-8 without BOM to make a multi-system portable script

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-29 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found