遇到一個字串顯示不正常的問題,語言設定中文時不會有問題,設定成日文就會。
找到最後發現程式某個地方用到反轉字串,使用了 _tcsrev
來完成。
由於專案比較舊,編碼集是用 MBCS 而不是 Unicode,
當設定成 MBCS 時,_tcsrev
被當作 _mbsrev
,
如果文字內容是 "a一b" (BIG5 編碼是 0x61 0xa4 0x40 0x62),
經過 _mbsrev
轉換後,在不同的語言設定下,會有不同的結果:
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
""" | |
This is a Python program for merging subtitle files, which uses the third-party library "srt"(https://github.com/cdown/srt) to parse and compose srt files. | |
The basic idea of the program is to parse the original srt file into multiple "srt.Subtitle" objects, and then iterate and process these objects. | |
For adjacent two subtitles, if the time interval between them is less than "MIN_TIME_INTERVALS" (defined in the program as the minimum time interval), they are merged into a new subtitle. | |
Specifically, the content of the original subtitles is extracted and connected with "separator_operator" (defined in the program as the separator), | |
and a new "srt.Subtitle" object is created with the new start and end times. | |
Finally, all the new "srt.Subtitle" objects are merged into a new srt file and output to standard output. |
void printHexdump( char *arr, int size) { | |
const unsigned int bytesOfType = sizeof( char); | |
const int numOfItemInRow = (0x10 / bytesOfType); | |
printf("=================================\n"); | |
int count = 0; | |
for (int i = 0; i <= size / numOfItemInRow; i++) { | |
printf("%06x ", i); | |
for (int j = 0; j < numOfItemInRow && count < size; j++) { | |
printf("%02x ", 0xff & arr[count++]); | |
} |
// | |
// main.cpp | |
// UnicodeEncoding | |
// | |
// Created by willard on 2019/9/25. | |
// Copyright 2019 willard. All rights reserved. | |
// | |
#include <iostream> | |
#include <iconv.h> |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Management.Automation; | |
using System.Management.Automation.Runspaces; | |
using System.Collections.ObjectModel; | |
namespace TestPowerShell |
// | |
// LineChartRenderer.swift | |
// Charts | |
// | |
// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda | |
// A port of MPAndroidChart for iOS | |
// Licensed under Apache License 2.0 | |
// | |
// https://github.com/danielgindi/Charts | |
// |
// | |
// main.swift | |
// ftest | |
// | |
// Created by willard on 2018/12/14. | |
// Copyright © 2018 willard. All rights reserved. | |
// | |
import Foundation |
inputDict = {'Store_name': 'Los Angeles', | |
'Sales': '1500', | |
'XXX' :555} | |
whereConditions = [] | |
for key, value in inputDict.items(): | |
cond = "%s = '%s'" % (key, value) | |
whereConditions.append(cond) | |
whereConditionSql = ' AND '.join(whereConditions) |
https步驟
先將 MyEThttp.cpp::103 改成 http,點綠色按鈕跑一次, 再打開瀏覽器輸入 網址 http://localhost:50175,看到網頁就代表server跑起來了。 網頁內容目前是寫在 MyEThttp.cpp::103 ,是靜態的,單純測試用。
建立 self-signed 憑證
使用系統管理員身份 打開 PowerShell, 輸入指令 New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -FriendlyName "TestCert" -NotAfter (Get-Date).AddYears(10) -Subject "localhost" -DnsName "localhost"
// | |
// ViewController.swift | |
// text | |
// | |
// Created by willard on 2018/4/2. | |
// Copyright © 2018年 willard. All rights reserved. | |
// | |
import UIKit |