Last active
August 29, 2015 14:02
-
-
Save sublee/6a6bbe00bc152b13042f to your computer and use it in GitHub Desktop.
[삺 문제] Unity3D 소스코드를 BOM 없이 UTF-8으로 저장하면, 코드가 OS 기본 인코딩(내 경우 cp949)으로 읽히면서 못 읽는 문자는 '?'로 치환됨. "사<LF>"로 끝나는 한 줄 주석을 쓰면 끝 부분이 "??"로 읽혀서 다음 줄까지 주석으로 인식됨.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
using System.Text; | |
public class UTF8SourceCode : MonoBehaviour { | |
void Start () { | |
/* string sa = "사"; error CS1010: Newline in constant */ | |
string sa = "사 | |
"; /* EC-82-AC-0A */ | |
string sasa = "사사"; /* EC-82-AC-EC-82-AC */ | |
Debug.Log(sa); /* ?? */ | |
Debug.Log(sasa); /* ?ъ궗 */ | |
Debug.Log(BitConverter.ToString(Encoding.Default.GetBytes(sa))); /* 3F-3F */ | |
Debug.Log(BitConverter.ToString(Encoding.Default.GetBytes(sasa))); /* 3F-AC-EC-82-AC */ | |
// 사 | |
throw new Exception("This exception won't be thrown."); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
using System.Text; | |
public class UTF8SourceCode : MonoBehaviour { | |
void Start () { | |
/* string sa = "??; error CS1010: Newline in constant */ | |
string sa = "??"; /* EC-82-AC-0A */ | |
string sasa = "?ъ궗"; /* EC-82-AC-EC-82-AC */ | |
Debug.Log(sa); /* ?? */ | |
Debug.Log(sasa); /* ??沅?*/ | |
Debug.Log(BitConverter.ToString(Encoding.Default.GetBytes(sa))); /* 3F-3F */ | |
Debug.Log(BitConverter.ToString(Encoding.Default.GetBytes(sasa))); /* 3F-AC-EC-82-AC */ | |
// ?? throw new Exception("This exception won't be thrown."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment