mysql设置名称utf8,“口袋妖怪”和“神奇宝贝”实际上相等?

时间:2017-12-11 10:26:54

标签: mysql utf-8 character-encoding

我测试了mysql命令行,有一个问题困惑我

set names utf8;

select STRCMP('pokemon','pokémon');

结果为零

STRCMP('pokemon','pokémon')
0

我希望它显示-1或1或其他

我试过“set names latin1”,这表明它们不相等。

set names latin1;
select STRCMP('pokemon','pokémon');

结果是1

STRCMP('pokemon','pokémon')
1

问题是什么?我能在utf8中得到像latin1的结果吗?

1 个答案:

答案 0 :(得分:0)

import numpy as np
from sklearn.ensemble import GradientBoostingRegressor
n_samples = 2000
n_features = 10
rng = np.random.RandomState(0)
X = rng.normal(size=(n_samples, n_features))
w = rng.normal(size=n_features)
# simple linear function without noise
y = np.dot(X, w)

gbrt = GradientBoostingRegressor(loss='quantile', alpha=0.95)

gbrt.fit(X, y)
# Get upper interval
upper_interval = gbrt.predict(X)
# Get lower interval
gbrt.set_params(alpha=0.05)
gbrt.fit(X, y)
lower_interval = gbrt.predict(X)
intervals = np.concatenate((lower_interval[:, np.newaxis], upper_interval[:, np.newaxis]), axis=1)
# This is 4 passes:
perc_correct_intervals = ((y >= intervals[:, 0]) & (y <= intervals[:, 1])).sum() / y.shape[0]
相关问题