为什么具有相同编码的字符串在MySQL和HTML上的呈现方式不同?

This is the input string that I entered in my HTML form:

람다 대수(λ -, lambda -)는 함수 정의, 함수 적용, 귀납적 함수를 수식으로 표현하기 위한 형식 체계이다. 1930년대 알론조 처치가 수학기초론을 연구하는 과정에서 람다 대수의 형식을 제안하

This is the string that appears in MySQL database field of TINYTEXT type:

람다 대수(λ -, lambda -)는 함수 ì •ì˜, 함수 ì ìš©, ê·€ë‚©ì  í•¨ìˆ˜ë¥¼ 수ì‹ìœ¼ë¡œ 표현하기 위한 í˜•ì‹ ì²´ê³„ì´

This is the output on the HTML page upon querying:

람다 대수(λ -, lambda -)는 함수 정의, 함수 적용, 귀납적 함수를 수식으로 표현하기 위한 형식 체계이

Both the HTML and the database are encoded in UTF-8. There are two things which I would like to ask:

  1. Why does the field in MySQL database render differently from the ones in HTML?
  2. What can I do to catch the length in bytes of the above string to ensure it is within the 255 limit of TINYTEXT?

Most likely the most common pitfall: You're not setting your database connection to the right encoding. See why do i have to use mb_convert_encoding($name,'ISO-8859-15','utf-8') to get accented chars to display?.