# Xcode build error: "UTF-16 (LE) byte order mark detected"

**URL:** <https://forums.unrealengine.com/t/xcode-build-error-utf-16-le-byte-order-mark-detected/390629>\
**Category:** Platform & Builds\
**Tags:** error, xcode, MAC, unreal-engine, building, CPP, question\
**Created:** [April 11, 2017, 6:41pm UTC](https://forums.unrealengine.com/t/xcode-build-error-utf-16-le-byte-order-mark-detected/390629 "2017-04-11T18:41:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamiewhitephd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jamiewhitephd](https://forums.unrealengine.com/u/jamiewhitephd)\
**Post date:** [April 11, 2017, 6:41pm UTC](https://forums.unrealengine.com/t/xcode-build-error-utf-16-le-byte-order-mark-detected/390629/1 "2017-04-11T18:41:56Z")

</div>

I’ve been working on a C++ based project for quite some time on Windows, but I wanted to see how the project runs on my Macbook.

After checking out the code, I couldn’t compile through the editor so I generated Xcode project files. However, when compiling through Xcode, I am hit with the following error affecting most of the source files including the “.generated” files: “UTF-16 (LE) byte order mark detected in … FILENAME HERE”.

I attempted to change text format but this error just won’t go away. Has anyone else encountered this? I get these errors even when creating a new C++ based project in the Epic Launcher. If it helps, it’s the “#include” lines the errors are located.

---

<div class="post-metadata">

**Author:** ![jamiewhitephd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jamiewhitephd](https://forums.unrealengine.com/u/jamiewhitephd)\
**Post date:** [April 17, 2017, 6:43pm UTC](https://forums.unrealengine.com/t/xcode-build-error-utf-16-le-byte-order-mark-detected/390629/2 "2017-04-17T18:43:04Z")

</div>

Still having problems with this.

---

<div class="post-metadata">

**Author:** ![jamiewhitephd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jamiewhitephd](https://forums.unrealengine.com/u/jamiewhitephd)\
**Post date:** [July 14, 2017, 9:58pm UTC](https://forums.unrealengine.com/t/xcode-build-error-utf-16-le-byte-order-mark-detected/390629/3 "2017-07-14T21:58:10Z")

</div>

Three months later, still having problems with this.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_505aa0131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_505aa0131](https://forums.unrealengine.com/u/anonymous_user_505aa0131)\
**Post date:** [October 30, 2017, 8:02pm UTC](https://forums.unrealengine.com/t/xcode-build-error-utf-16-le-byte-order-mark-detected/390629/4 "2017-10-30T20:02:49Z")

</div>

I’ve the same issue. Changing encoding in xcode 9 doesn’t help. However, I got it working by converting all the generated class and header files (using sublime 3, should be the same with other text editors ) from UTF16 to UTF-8 and it works.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_508ad1e3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_508ad1e3](https://forums.unrealengine.com/u/anonymous_user_508ad1e3)\
**Post date:** [December 2, 2018, 11:29pm UTC](https://forums.unrealengine.com/t/xcode-build-error-utf-16-le-byte-order-mark-detected/390629/5 "2018-12-02T23:29:28Z")

</div>

I just encountered this issue in UE 4.21.0. I didn’t look deep into it, but I believe the issue was caused by a non UTF-8 symbol added in my source files. In my case, the symbol which caused issues was “©” in my copyright notice and all of my source files. Most of my files contained a replacement character (�), however the ones that had errors did not for some reason. I resolved this by removing the © and � characters from all of my source files and removing the special character from my copyright template in the project settings.

---

<div class="post-metadata">

**Author:** ![sortof](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sortof](https://forums.unrealengine.com/u/sortof)\
**Post date:** [December 26, 2024, 2:43pm UTC](https://forums.unrealengine.com/t/xcode-build-error-utf-16-le-byte-order-mark-detected/390629/6 "2024-12-26T14:43:51Z")

</div>

I solved this problem in a similar way but using vscode for Mac; saving as encoding: UTF-8 without BOM, and only for the file that caused the error rather than all generated files.
