Coding/Python

๋ฐ์ดํ„ฐ ์ €์žฅ์‹œ ์ธ์ฝ”๋”ฉ ์˜ค๋ฅ˜

๊น€์œ ๋‹ˆ์ฝ˜ 2022. 2. 21. 10:50

ํฌ๋กค๋ง ํ›„ ๋ฐ์ดํ„ฐ ์ €์žฅ์‹œ ์ธ์ฝ”๋”ฉ์„ utfmb4๋กœ ์„ค์ •ํ–ˆ๋Š”๋ฐ๋„ 

 

'utf-8' codec can't encode characters in position 188-189: surrogates not allowed

์˜ค๋ฅ˜๊ฐ€ ๋œจ๋ฉด  ์ด๋ชจํ‹ฐ์ฝ˜ ์˜ค๋ฅ˜๋ฅผ ๊ณ ๋ คํ•ด๋ณด์ž.

 

 

 

์ด๋ชจ์ง€๋ฅผ ์ œ๊ฑฐํ•˜๋Š” ํ•จ์ˆ˜ ๋งŒ๋“ค์–ด์„œ ์‚ฌ์šฉํ•ด ํ•ด๊ฒฐ!

def rmEmoji(inputData):
    return inputData.encode('utf-8', 'ignore').decode('utf-8')