fix: Windows 한글 깨짐 해결 및 문서화
- UTF-8 인코딩 강제 코드 추가 (Windows cp949 문제 해결) - import_products_from_mssql.py: 한글 제품명 정상 출력 - view_products.py: 한글 카테고리명 정상 출력 - CLAUDECODE.md: Windows 한글 깨짐 해결 방법 문서화 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5cab3229db
commit
6026f0aae8
@ -428,6 +428,35 @@ Flask 서버는 콘솔에 로그를 출력합니다:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 💡 개발 팁
|
||||||
|
|
||||||
|
### Windows 한글 깨짐 해결
|
||||||
|
|
||||||
|
**문제**: Python 스크립트 실행 시 한글이 깨져서 출력됨 (cp949 인코딩 문제)
|
||||||
|
|
||||||
|
**해결 방법**: 스크립트 상단에 UTF-8 인코딩 강제 코드 추가
|
||||||
|
|
||||||
|
```python
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
# UTF-8 인코딩 강제 (Windows 한글 깨짐 방지)
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
|
# 나머지 코드...
|
||||||
|
```
|
||||||
|
|
||||||
|
**적용된 파일**:
|
||||||
|
- `backend/import_products_from_mssql.py`
|
||||||
|
- `backend/view_products.py`
|
||||||
|
|
||||||
|
**효과**: 한글 제품명, 카테고리명이 정상적으로 출력됨
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 📚 참고 자료
|
## 📚 참고 자료
|
||||||
|
|
||||||
### 주요 라이브러리
|
### 주요 라이브러리
|
||||||
@ -437,13 +466,15 @@ Flask 서버는 콘솔에 로그를 출력합니다:
|
|||||||
- Pillow: 이미지 처리
|
- Pillow: 이미지 처리
|
||||||
- brother_ql: Brother QL 프린터 제어
|
- brother_ql: Brother QL 프린터 제어
|
||||||
- PyQt5: POS GUI
|
- PyQt5: POS GUI
|
||||||
|
- OpenAI: AI 분석 및 제품 태깅
|
||||||
|
|
||||||
### 외부 링크
|
### 외부 링크
|
||||||
- Flask 문서: https://flask.palletsprojects.com/
|
- Flask 문서: https://flask.palletsprojects.com/
|
||||||
- Brother QL Python: https://github.com/pklaus/brother_ql
|
- Brother QL Python: https://github.com/pklaus/brother_ql
|
||||||
- QRCode 문서: https://pypi.org/project/qrcode/
|
- QRCode 문서: https://pypi.org/project/qrcode/
|
||||||
|
- OpenAI API: https://platform.openai.com/docs
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**마지막 업데이트**: 2026-01-23
|
**마지막 업데이트**: 2026-01-23
|
||||||
**버전**: Phase 3 완료 (간편 적립 + 관리자 페이지 + 거래 세부 조회)
|
**버전**: Phase 3 완료 (간편 적립 + 관리자 페이지 + 거래 세부 조회 + 제품 태깅 시스템)
|
||||||
|
|||||||
@ -4,6 +4,13 @@ MSSQL에서 바코드 제품 데이터를 가져와서 product_master에 채우
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
# UTF-8 인코딩 강제 (Windows 한글 깨짐 방지)
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(__file__))
|
sys.path.insert(0, os.path.dirname(__file__))
|
||||||
|
|
||||||
from db.dbsetup import DatabaseManager
|
from db.dbsetup import DatabaseManager
|
||||||
|
|||||||
@ -2,10 +2,17 @@
|
|||||||
product_master 제품 조회
|
product_master 제품 조회
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
# UTF-8 인코딩 강제 (Windows 한글 깨짐 방지)
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
import io
|
||||||
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||||
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||||
|
|
||||||
def view_products():
|
def view_products():
|
||||||
"""product_master 제품 조회"""
|
"""product_master 제품 조회"""
|
||||||
db_path = os.path.join(os.path.dirname(__file__), 'db', 'mileage.db')
|
db_path = os.path.join(os.path.dirname(__file__), 'db', 'mileage.db')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user