Skip to main content
Participant
July 14, 2009
Question

We need utf-8 BOM in *.cf* Files

  • July 14, 2009
  • 3 replies
  • 3394 views

In the Coldfusion8 Doc you can read:

Adobe recommends that you use BOM characters in your files.

(http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=i18n_10.html)

How can we change the encoding from utf-8 without BOM to utf-8 with BOM? I think it is an internal eclipse problem.

Does anyone know a goog solution for this problem?

This topic has been closed for replies.

3 replies

Participant
May 6, 2010

Thanks Paul,

it so strange...

since you made a response to me, I tried to install CFB on my home pc.

and it's just incredible work fine..    =  ="

I think the problem is on my work pc...........

I will try it tomorrow,

and thanks for your enthusiastic help.

Participant
May 6, 2010

I have the same problem !!!

In my case, we need to output chinese/japanese pages.

The CFB (ColdFusion Builder) do not write BOM to .cfm files, so it will display random code when we save>close>reopen it.

and also, CF server 8 do not display correct characters in web page.

But, if we reopen it and save it to UTF8 by notepad. (or by Dreamweaver with BOM checked)

it will display chinese/japanese normally.....

we don't want to re-save all files by notepad or other applications.

and for edit these files by CFB, I think the BOM function is necessary.

Adan wrote:

If you tell CFB to create new files as UTF-8, it will.  It does not put a BOM in the file, but the BOM is not necessary for the file to be recognised as UTF-8.  Equally, there is no problem if your files do have a BOM.

actually, the problem CFB create files as UTF-8 without BOM is we have no idea to edit a cfml include other language like chinese or japanese !!

how can we slove this problem?

(I know the BOM is not necessary for UTF-8. but if I want to edit a cfm with chinese characters inside, it seems to be necessary.)

(Sorry if I misspelled something, my native language is chinese.)

Inspiring
May 6, 2010

the unicode spec says the BOM is optional for UTF-8 (which if you think about

it's not needed, there's only the 1 byte order for UTF-8). eclipse, which cf

builder (CFB), cfeclipse (CFE), et al is based on, doesn't write out a BOM.

i use thai, japanese, arabic, etc. in cf files edited w/CFB, CFE & even with

notepad (don't ask). all work fine.

are you sure your files are utf-8 encoded in the 1st place? can you zip up &

attach a simple example of one that's causing you problems?

Participant
October 8, 2009

I try the new Beta2 and we have the same problem!

Does anyone know a good solution for this problem?

Inspiring
October 8, 2009

The docs are talking nonsense: there's not need to specify a BOM.  Just set your default encoding to UTF-8.

If your CF templates have any non-ASCII characters in them, then tell the compiler to expect UTF-8 data using the <cfprocessingdirective> tag.

--

Adam

Participant
October 8, 2009

Hello Adam

I think this is not a good solution. All of our current files uses UTF-8 BOM we don't want do change every file.

How can we change the default compiler behavor to recognize all files as UTF-8?

How can we change the default processingdirective?

Every good texteditor can add BOM to UTF-8 Files.