You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: result_encoder.go
    path of file: ./repos/tidb/pkg/server/internal/column
    
    the code of the file until where you have to start completion: // Copyright 2015 PingCAP, Inc.
//
// Licensed under the Apache Licen
    
func (d *ResultEncoder) ColumnTypeInfoCharsetID(info *Info) uint16 {
	// Only replace the charset when @@character_set_results is valid and
	// the target column is a non-binary string.
	if d.isNull || len(d.chsName) == 0 || !isStringColumnType(info.Type) {
		return info.Charset
	}
	if info.Charset == mysql.BinaryDefaultCollationID {
		return mysql.BinaryDefaultCollationID
	}
	return uint16(mysql.CharsetNameToID(d.chsName))
}