문제 설명
Windows‑1256으로 인코딩된 문자를 올바르게 표시할 수 있도록 파일의 코드 페이지를 강제 실행하시겠습니까? (Forcinge the codepage of a file so that it can show characters encoded with windows‑1256 correctly?)
아랍 문자가 포함된 일반 텍스트 파일을 저장해야 하며 파일을 열 때 아랍어 문자가 아랍어로 나타나야 합니다.
Encoding.GetEncoding(1256)
을 사용하여 문제 없이 이름을 만들고 파일을 저장합니다. 다시 1256을 StreamWriter
의 코드 페이지로 사용합니다.
그러나 볼 때 메모장++의 결과 파일은 문자가 올바르게 표시되지 않으며 아랍어로 표시하려면 코드 페이지를 의도적으로 다시 1256으로 전환해야 합니다.
그런 다음 파일을 제3자에게 전송하고 있지만 문자가 전송되지 않습니다. 코드 페이지를 변경하십시오(이유를 모르겠습니다!). 따라서 아랍어를 읽을 수 없습니다.
사용할 코드 페이지가 파일에 "포함"되도록 파일을 저장할 수 있는 방법이 있습니까?
참조 솔루션
방법 1:
Save the file as UTF‑8. That should automatically include a magic BOM (Byte Order Mark) in the beginning of the file so applications opening the file will know it is encoded in UTF‑8.
(by BlueChippy、krisku)