> For the complete documentation index, see [llms.txt](https://sdc-james.gitbook.io/onebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sdc-james.gitbook.io/onebook/3./3.9.-strings/3.9.1.-unicode.md).

# 4.9.1.     Unicode 한글의 사용

문자 인코딩이란 "특정한 문자 집합 안의 문자들을 컴퓨터 시스템에서 사용할 목적으로 일정한 범위 안의 정수들로 변환하는 방법"을 말합니다.&#x20;

한글이 저장되는 방식은 Unicode, UTF8, EUC-KR, CP949 네 가지가 있는데 유니코드는 문자코드가 각국의 윈도우마다 겹치는 영역이 존재하기 때문에 이러한 현상이 발생하지 않기 위해 전세계 모든 언어에 겹치지 않는 코드를 할당(=매핑)한 코드를 말합니다. UTF8은 유니코드 기반의 가변 길이 문자 인코딩 방식을 말합니다.

파이썬의 일반 문자열은 내부적으로 8 비트 ASCII로 저장되는 반면, 유니코드 문자열은 16 비트 유니코드로 저장됩니다. 이것은 세계의 대부분의 언어에서 특수 문자를 포함하여 보다 다양한 문자 집합을 허용하기 위함입니다. 유니 코드 문자열은 접두사 u를 사용합니다.

만약 여러분이 한글 윈도우에서 작업하고 있다면, system의 location code는 cp949 일 것입니다. 하지만 리눅스일 경우, system의 location code는 UTF-8이 됩니다.

파이썬에서 한글을 사용하기 위해서는 변환이 필요합니다. print 함수의 경우 유니코드는 알아서 컴퓨터의 로케일 문자열로 변환해 보여줍니다.

```python
import sys

 print(sys.stdin.encoding)
 print(u'Hello, world!')
 a = u"한글"
 print(a) 
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sdc-james.gitbook.io/onebook/3./3.9.-strings/3.9.1.-unicode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
