Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.programmer Subject: A proposal to handle file encodings Date: Thu, 22 Nov 2012 13:36:16 -0800 Organization: Canadian Mind Products Lines: 25 Message-ID: Reply-To: Roedy Green NNTP-Posting-Host: K2Qzzs3EAqXk5RLzfhxcSw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: csiph.com comp.lang.java.programmer:19856 The problem with encodings is they are not attached in any way or embedded in any way in a file. You are just supposed to know how a file is encoded. Here is my idea to solve the problem. We invent a new encoding. Files in this encoding begin with a 0 byte, then an ASCII string giving the name of a conventional encoding then another 0 byte. When you read a file with this encoding, the header is invisible to your application. When you write a file, a header for a UTF8 file gets written automatically. You write your app telling it to read and write this new encoding e.g. "labeled". You can write a utilty to import files into your labelled universe by detecting or guessing or being told the encoding. It gets a header. Other than that the file is unmodified. -- Roedy Green Canadian Mind Products http://mindprod.com Students who hire or con others to do their homework are as foolish as couch potatoes who hire others to go to the gym for them.