字符编码统一GBK

This commit is contained in:
2026-06-28 19:32:57 +08:00
parent 04904c2919
commit 685a2094f7
5 changed files with 31 additions and 31 deletions

View File

@@ -2,8 +2,8 @@
BOOL ReplaceFileContent(LPCTSTR lpFile, std::vector<std::string>& vtOldContent, std::vector<std::string>& vtNewContent);
/// <summary>
/// 启动子进程并捕获 stdout/stderr。
/// nOutputCodePage 为管道原始字节的解码代码页,默认 CP_ACP按系统 ANSI/GBK 直接使用);
/// CP_UTF8 时先按 UTF-8 解码为宽字符MultiByte 工程再转为 GBK 存入 CString。
/// 启动子进程并捕获 stdout/stderr。
/// nOutputCodePage 为管道原始字节的解码代码页,默认 CP_ACP按系统 ANSI/GBK 直接使用);
/// CP_UTF8 时先按 UTF-8 解码为宽字符MultiByte 工程再转为 GBK 存入 CString。
/// </summary>
CString StartProcess(LPCTSTR program, LPCTSTR args, LPCTSTR lpCurrentDirectory, UINT nOutputCodePage = CP_ACP);

View File

@@ -1,23 +1,23 @@
#pragma once
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 部分 CString 构造函数将是显式的
#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS // 移除对话框中的 MFC 控件支持
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 部分 CString 构造函数将是显式的
#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS // 移除对话框中的 MFC 控件支持
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // 从 Windows 头文件中排除极少使用的内容
#define VC_EXTRALEAN // 从 Windows 头文件中排除极少使用的内容
#endif
#include <afx.h>
#include <afxwin.h> // MFC 核心组件和标准组件
#include <afxext.h> // MFC 扩展
#include <afxwin.h> // MFC 核心组件和标准组件
#include <afxext.h> // MFC 扩展
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <iostream>

View File

@@ -833,7 +833,7 @@ namespace httplib {
// Without :// or //, the entire input must be consumed as host[:port].
// If there is leftover (path, query, etc.), this is not a valid
// host[:port] string clear and reparse as a plain path.
// host[:port] string ¡ª clear and reparse as a plain path.
if (!has_authority_prefix && pos < url.size()) {
uc.host.clear();
uc.port.clear();
@@ -960,7 +960,7 @@ namespace httplib {
/*
* detail: type-erased storage used by UserData.
* ABI-stable regardless of C++ standard always uses this custom
* ABI-stable regardless of C++ standard ¡ª always uses this custom
* implementation instead of std::any.
*/
namespace detail {
@@ -1402,7 +1402,7 @@ namespace httplib {
std::string body;
std::string location; // Redirect location
// User-defined context set by pre-routing/pre-request handlers and read
// User-defined context ¡ª set by pre-routing/pre-request handlers and read
// by route handlers to pass arbitrary data (e.g. decoded auth tokens).
UserData user_data;
@@ -5172,7 +5172,7 @@ namespace httplib {
if (!detail::fields::is_field_value(val)) { return false; }
// RFC 9110 §5.5: header field values are opaque octets and MUST NOT be
// RFC 9110 ¡ì5.5: header field values are opaque octets and MUST NOT be
// percent-decoded by the recipient. Applications that need to interpret a
// value as a URI component should call httplib::decode_uri_component()
// (or decode_path_component()) explicitly.
@@ -6537,7 +6537,7 @@ namespace httplib {
// Recursive form retained so operator""_t below can compute hashes for
// switch-case labels at compile time (C++11 constexpr forbids loops). Do not
// call from runtime paths with arbitrary-length inputs use str2tag()
// call from runtime paths with arbitrary-length inputs ¡ª use str2tag()
// instead, which is iterative and stack-safe.
inline constexpr unsigned int str2tag_core(const char* s, size_t l,
unsigned int h) {
@@ -10878,7 +10878,7 @@ namespace httplib {
}
// Bracketed entries can only be IPv6. If the IPv6 parse above failed,
// the entry is malformed don't fall through to the hostname branch.
// the entry is malformed ¡ª don't fall through to the hostname branch.
if (bracketed) { return false; }
// A '/' on a non-IP token means a CIDR prefix without an address. Reject.
@@ -11791,7 +11791,7 @@ namespace httplib {
size_t /*len*/) { return receiver(buf, n); };
}
// RFC 9112 §6: no Transfer-Encoding and no Content-Length means no body.
// RFC 9112 ¡ì6: no Transfer-Encoding and no Content-Length means no body.
// For non-SSL builds we still scan non-persistent connections for stray
// body bytes so the payload limit is enforced (413). On keep-alive,
// pending bytes may be the next request (issue #2450), so skip.
@@ -12469,7 +12469,7 @@ namespace httplib {
return write_response(strm, close_connection, req, res);
}
// RFC 9112 §6.3: Reject requests with both a non-zero Content-Length and
// RFC 9112 ¡ì6.3: Reject requests with both a non-zero Content-Length and
// any Transfer-Encoding to prevent request smuggling. Content-Length: 0 is
// tolerated for compatibility with existing clients.
if (req.get_header_value_u64("Content-Length") > 0 &&
@@ -12711,7 +12711,7 @@ namespace httplib {
}
// Drain any unconsumed framed body to prevent request smuggling on
// keep-alive. Without framing there is no body to drain reading would
// keep-alive. Without framing there is no body to drain ¡ª reading would
// consume the next request (issue #2450).
if (!req.body_consumed_ && detail::has_framed_body(req)) {
int dummy_status;
@@ -13025,7 +13025,7 @@ namespace httplib {
#endif
if (!is_alive) {
// Peer seems gone non-graceful shutdown to avoid SIGPIPE.
// Peer seems gone ¡ª non-graceful shutdown to avoid SIGPIPE.
disconnect(/*gracefully=*/false);
}
}
@@ -13402,7 +13402,7 @@ namespace httplib {
stream_line_reader lr(strm, line_buf, sizeof(line_buf));
if (!lr.getline()) { return -1; }
// RFC 9112 §7.1: chunk-size = 1*HEXDIG
// RFC 9112 ¡ì7.1: chunk-size = 1*HEXDIG
const char* p = lr.ptr();
int v = 0;
if (!is_hex(*p, v)) { return -1; }
@@ -13807,7 +13807,7 @@ namespace httplib {
}
// Proxy-Authorization is only sent when the proxy is actually used for
// this target otherwise NO_PROXY-matched requests would leak proxy
// this target ¡ª otherwise NO_PROXY-matched requests would leak proxy
// credentials directly to the destination server.
if (is_proxy_enabled_for_host(host_)) {
if (!proxy_basic_auth_username_.empty() &&

View File

@@ -1,5 +1,5 @@
// pch.cpp: 与预编译标头对应的源文件
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
// 当使用预编译的头时,需要使用此源文件,编译才能成功。

View File

@@ -1,13 +1,13 @@
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H