Skip to content

Instantly share code, notes, and snippets.

@nobodxbodon
nobodxbodon / extension.ts
Created April 26, 2020 06:38
vs code插件 auto-correct 基础上实现了中文标点符号自动替换为英文标点符号的原型
'use strict';
import * as vscode from 'vscode';
import { getWords } from './helpers';
const ks = require('node-key-sender');
// let config: vscode.WorkspaceConfiguration;
let words: any;
// let triggers: string[];
网站 支持中文命名 调试信息显示正确 测试语言 细节
码农谷 Java 编译速度一般, 但对Java中文命名的支持最好
闪电编程 大部分 Java public类只能用英文命名, 非public类和方法/变量都支持
dooccn 大部分 Java 同闪电编程
w3school.com.cn JavaScript 调试信息在浏览器控制台中, 中文字符显示的是unicode原码: \u4EBA is not defined
jsfiddle.net JavaScript 同w3school
IDEOne 部分 Java 类名不能为中文: Runtime Error. 方法/变量可以.
AnyCodes 部分 Java 类名不能为中文: There must be a public class. Please check your code. 方法/变量可以.
CodePad C, Python
@nobodxbodon
nobodxbodon / test_gcc.log
Last active November 26, 2017 06:25
test gcc with chinese keywords
without change:
$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
$ gcc 你好.c
你好.c:10:1: error: stray ‘\351’ in program
void 问好();
^
你好.c:10:1: error: stray ‘\227’ in program
你好.c:10:1: error: stray ‘\256’ in program
$ export LC_ALL=zh_CN.gbk
xw@xw-Rev-1-0:~/workspace/checkstyle$ locale
LANG=zh_CN.UTF-8
LANGUAGE=zh_CN:en_US:en
LC_CTYPE="zh_CN.gbk"
LC_NUMERIC="zh_CN.gbk"
LC_TIME="zh_CN.gbk"
LC_COLLATE="zh_CN.gbk"
LC_MONETARY="zh_CN.gbk"
LC_MESSAGES="zh_CN.gbk"
@nobodxbodon
nobodxbodon / gulp_runtests.log
Created October 19, 2017 18:01
CHTypeScript - 运行gulp runtests后的错误输出
$ gulp runtests
[07:38:05] Requiring external module ts-node/register
[07:38:06] Using gulpfile ~/work/program-in-chinese/CHTypeScript/gulpfile.ts
[07:38:06] Starting 'build-rules'...
[07:38:07] Starting 'built/local/lib.dom.d.ts'...
[07:38:07] Starting 'built/local/lib.dom.iterable.d.ts'...
[07:38:07] Starting 'built/local/lib.webworker.d.ts'...
[07:38:07] Starting 'built/local/lib.scripthost.d.ts'...
[07:38:07] Starting 'built/local/lib.es5.d.ts'...
[07:38:07] Starting 'built/local/lib.es2015.d.ts'...
@nobodxbodon
nobodxbodon / gulp_tests.log
Created October 19, 2017 00:12
CHTypeScript - 运行gulp tests后的输出错误
$ gulp tests
[16:56:38] Requiring external module ts-node/register
[16:56:38] Using gulpfile ~/work/program-in-chinese/CHTypeScript/gulpfile.ts
[16:56:38] Starting 'built/local/lib.dom.d.ts'...
[16:56:38] Starting 'built/local/lib.dom.iterable.d.ts'...
[16:56:38] Starting 'built/local/lib.webworker.d.ts'...
[16:56:38] Starting 'built/local/lib.scripthost.d.ts'...
[16:56:38] Starting 'built/local/lib.es5.d.ts'...
[16:56:38] Starting 'built/local/lib.es2015.d.ts'...
[16:56:38] Starting 'built/local/lib.es2016.d.ts'...
@nobodxbodon
nobodxbodon / 乱码溯因.java
Last active October 12, 2017 06:51
win1252(cp1252), iso8859, utf8转换乱码问题 http://bbs.csdn.net/topics/390010852
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
/**
* 原问题在 http://bbs.csdn.net/topics/390010852:
* 代码如下:
try
{
PreparedStatement preStmt = con.prepareStatement("insert into t_bb(f_no,f_name) values(?,?)");
preStmt.setString(1,"ABCDEFG");
@nobodxbodon
nobodxbodon / UTF8_GBK.java
Created October 12, 2017 04:47
为验证偶数个字符在UTF8<->GBK互转时也会出现乱码 https://github.com/program-in-chinese/overview/issues/26#issuecomment-336012338
import java.io.UnsupportedEncodingException;
public class UTF8_GBK {
public static void main(String[] args) throws UnsupportedEncodingException {
String 初始字符串 = "开始";
byte[] 字节 = 初始字符串.getBytes("utf-8");
System.out.println("转码前:" + encodeHex(字节));
String 转编码后 = new String(字节, "GBK");
import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.UnsupportedEncodingException;
/**
* 问题复现:
文件编码为UTF-8
控制台编码先为UTF-8:
$ javac -encoding utf8 EncodeIssue.java