Click here to Skip to main content
15,886,919 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
PIEBALDconsult29-Sep-23 9:33
mvePIEBALDconsult29-Sep-23 9:33 
GeneralRe: The changing landscape of OOP (from class to struct) Pin
honey the codewitch4-Oct-23 4:56
mvahoney the codewitch4-Oct-23 4:56 
RantThe Day I Learned to Deal With the BOM Pin
kmoorevs15-Sep-23 9:21
kmoorevs15-Sep-23 9:21 
GeneralRe: The Day I Learned to Hate the BOM Pin
trønderen15-Sep-23 9:53
trønderen15-Sep-23 9:53 
GeneralRe: The Day I Learned to Hate the BOM Pin
kmoorevs17-Sep-23 12:25
kmoorevs17-Sep-23 12:25 
GeneralRe: The Day I Learned to Hate the BOM Pin
PIEBALDconsult20-Sep-23 12:20
mvePIEBALDconsult20-Sep-23 12:20 
GeneralRe: The Day I Learned to Deal With the BOM Pin
Richard MacCutchan17-Sep-23 22:03
mveRichard MacCutchan17-Sep-23 22:03 
GeneralRe: The Day I Learned to Deal With the BOM Pin
PIEBALDconsult20-Sep-23 12:18
mvePIEBALDconsult20-Sep-23 12:18 
"UTF-8 BOM considered harmful." Big Grin | :-D

I'm assuming you're talking about UTF-8. Including a BOM with UTF-8 is generally unnecessary and frowned upon in most cases.
I'll have to review my latest text file reader to see what I do with them -- one I wrote earlier this year would ignore a UTF-8 BOM if it was the first three bytes of a file.

In general, a file should have only one encoding, but there is no requirement for that to be the case. If a file switches between encoding, then I believe a suitable BOM must be used to indicate that. But good luck finding a reader which will honor such an abomination.
When this sort of thing is more likely to be a concern is when reading from a non-file-backed stream such as a socket -- but I would expect that other controls would be put in place to avoid confusion.


Now I need to go create a CSV file which is UTF-8, but with a UTF-16 Word document as one of its values... Poke tongue | ;-P (muhahaha!)
GeneralRe: The Day I Learned to Deal With the BOM Pin
honey the codewitch4-Oct-23 4:59
mvahoney the codewitch4-Oct-23 4:59 
Generaljsfiddle nightmare: Schrodinger's lost code Pin
raddevus4-Aug-23 4:45
mvaraddevus4-Aug-23 4:45 
GeneralRe: jsfiddle nightmare: Schrodinger's lost code Pin
Richard Deeming4-Aug-23 4:49
mveRichard Deeming4-Aug-23 4:49 
GeneralRe: jsfiddle nightmare: Schrodinger's lost code Pin
raddevus4-Aug-23 4:59
mvaraddevus4-Aug-23 4:59 
PraiseRe: jsfiddle nightmare: Schrodinger's lost code Pin
Slacker00729-Aug-23 6:43
professionalSlacker00729-Aug-23 6:43 
GeneralRe: jsfiddle nightmare: Schrodinger's lost code Pin
Gary R. Wheeler7-Sep-23 13:01
Gary R. Wheeler7-Sep-23 13:01 
JokeRe: jsfiddle nightmare: Schrodinger's lost code Pin
Peter_in_27807-Sep-23 13:15
professionalPeter_in_27807-Sep-23 13:15 
GeneralRe: jsfiddle nightmare: Schrodinger's lost code Pin
Richard Deeming7-Sep-23 21:32
mveRichard Deeming7-Sep-23 21:32 
GeneralRe: jsfiddle nightmare: Schrodinger's lost code Pin
Jeremy Falcon25-Sep-23 8:04
professionalJeremy Falcon25-Sep-23 8:04 
GeneralMicrosoft IIS FTP docs Pin
raddevus7-Jul-23 8:56
mvaraddevus7-Jul-23 8:56 
GeneralRe: Microsoft IIS FTP docs Pin
honey the codewitch26-Jul-23 9:32
mvahoney the codewitch26-Jul-23 9:32 
GeneralOne of the worst routines I've ever written. Shame on me? Pin
honey the codewitch21-Jun-23 3:16
mvahoney the codewitch21-Jun-23 3:16 
GeneralRe: One of the worst routines I've ever written. Shame on me? Pin
charlieg27-Jun-23 15:30
charlieg27-Jun-23 15:30 
GeneralRe: One of the worst routines I've ever written. Shame on me? Pin
honey the codewitch27-Jun-23 15:32
mvahoney the codewitch27-Jun-23 15:32 
QuestionRe: One of the worst routines I've ever written. Shame on me? Pin
Eddy Vluggen2-Sep-23 11:05
professionalEddy Vluggen2-Sep-23 11:05 
AnswerRe: One of the worst routines I've ever written. Shame on me? Pin
honey the codewitch2-Sep-23 11:20
mvahoney the codewitch2-Sep-23 11:20 
GeneralRe: One of the worst routines I've ever written. Shame on me? Pin
Daniel Pfeffer2-Sep-23 18:59
professionalDaniel Pfeffer2-Sep-23 18:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.