-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add encoding utils #179
Add encoding utils #179
Conversation
2. add CharsetUtil
Codecov Report
@@ Coverage Diff @@
## master #179 +/- ##
============================================
+ Coverage 34.60% 34.73% +0.13%
- Complexity 662 676 +14
============================================
Files 75 76 +1
Lines 5627 5674 +47
Branches 1075 1089 +14
============================================
+ Hits 1947 1971 +24
- Misses 3436 3450 +14
- Partials 244 253 +9
|
I don't think it is a good idea to check if a byte array is UTF-8 encoded. It is more reasonable to test if default charset is UTF-8. |
*/ | ||
public class CharsetUtil { | ||
|
||
public static Logger CHARSET_MONITOR_LOG = LoggerFactory.getLogger("CHARSET_MONITOR_LOG"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个配置方式是希望用户自己配 CHARSET_MONITOR_LOG 吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个配置方式是希望用户自己配 CHARSET_MONITOR_LOG 吗?
是的,用户自己配置 LOGGER 更加灵活,例如可以为日志打印添加MDC(traceId、方法入参)
This utility class is used to detect whether a system that uses UTF-8 encoding has read non-UTF-8 encoded data from other data streams. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
(cherry picked from commit efa6342)
* 2.0.0 (#176) - 升级 JDK17 - 适配 slf4j2 与 reload4j - 升级 log4j2 与 logback 版本 - 移除 @deprecated 代码 * 2.0.0 fix javadoc (#177) * use reload log4j (#178) Co-authored-by: “HzjNeverStop” <“441627022@qq.com”> * use singleton console appender for space * update CommonLoggingConfigurations * update maven stage plugin to 1.6.13 * Merge 1.3.11 (#182) * Add encoding utils (#179) (cherry picked from commit efa6342) * Add LegacySpringBanUtil (#180) Co-authored-by: “HzjNeverStop” <“441627022@qq.com”> (cherry picked from commit 99d321b) * release 2.0.0 (#183) Co-authored-by: “HzjNeverStop” <“441627022@qq.com”> --------- Co-authored-by: “HzjNeverStop” <“441627022@qq.com”>
No description provided.