Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-06-05
06:21 • Closed ticket [966046ffff]: Unicode byte order header (FFFE / FEFF) not written<... artifact: 72ef870c59 user: hobbs
03:21 • Pending ticket [966046ffff]. artifact: 6b573236ba user: dgp
2004-06-03
19:42 • New ticket [966046ffff]. artifact: cbfcb32de2 user: atfrost

Unicode byte order header (FFFE / FEFF) not written

Closed / Rejected966046ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2004-06-03 19:42:09
Files written using the "unicode" encoding configuration 
under Tcl 8.4 appear to be missing the Unicode byte-
order specification header (FFFE for little-endian, FEFF 
for big-endian).

Following is a dump of a text file created 
using "fconfigure $outfile -encoding unicode"; there is no 
byte order header couplet present.

Running the "file" command on this file gives type "data" 
on my BSD system.  Files with the byte order couplet 
register as "Little-endian UTF-16 Unicode character 
data" or similar.


tpark 12:45:02 [~/scripts/Library] od -a 
output_google_unicode.txt.b  | head
0000000    C nul   a nul   m nul   p nul   a nul   i nul   g 
nul   n nul
0000020   ht nul   C nul   a nul   m nul   p nul   a nul   i 
nul   g nul
0000040    n nul  sp nul   D nul   a nul   i nul   l nul   y 
nul  sp nul
0000060    B nul   u nul   d nul   g nul   e nul   t nul   ( 
nul   U nul
0000100    S nul   D nul   ) nul  ht nul   A nul   d nul  sp 
nul   G nul
0000120    r nul   o nul   u nul   p nul  ht nul   R nul   e 
nul   p nul
0000140    o nul   r nul   t nul  sp nul   T nul   y nul   p 
nul   e nul
0000160   ht nul   M nul   a nul   x nul  sp nul   C nul   P 
nul   C nul
0000200    ( nul   U nul   S nul   D nul   ) nul  ht nul   K 
nul   e nul
0000220    y nul   w nul   o nul   r nul   d nul  sp nul   T 
nul   y nul
dgpplain2004-06-05 03:21:07
Logged In: YES 
user_id=80530

This has been brought up before,
and I believe the conclusion has
been that whether or not a BOM
should  be written is something
that can only be determined by
the application.
hobbsplain2004-06-05 06:21:51
Logged In: YES 
user_id=72656

That is correct - this is an application specific thing,
especially since you can switch encodings on the fly
mid-stream.  Also, encodings are just on channels, and some
channels will need BOMs while some will not - only the app
writer really knows.  There has been discussion about
improving Tcl's auxiliary support for BOMs, but no good APIs
have been recommended.
Log in (anonymous is fine) to add a comment.