0

svn outputs garbled characters on Windows, it seems that utf-8 output of svn was read by terminal in gb2312.

the activity code page of windows is set to utf-8(65001),but the system region code page is gb2312(936).see below:

function Verify-Registry-Settings { Write-Host "=== Verify registry Settings ===" -ForegroundColor Cyan $regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Nls\CodePage" $acp = Get-ItemProperty -Path $regPath -Name "ACP" -ErrorAction SilentlyContinue $oemcp = Get-ItemProperty -Path $regPath -Name "OEMCP" -ErrorAction SilentlyContinue $maccp = Get-ItemProperty -Path $regPath -Name "MACCP" -ErrorAction SilentlyContinue Write-Host "ACP (ANSI code page): $($ACp.ACP)" -ForegroundColor $(if($ACp.ACp-eq '65001'){'Green'}else{'Red'}) Write-Host "OEMCP (OEM code page): $($oemcp.oemcp)" -ForegroundColor $(if($oemcp.oemcp-eq '65001'){'Green'}else{'Red'}) Write-Host "MACCP (Mac Code page): $($maccp.mACCp)" -ForegroundColor $(if($maccp.maccp-eq '65001'){'Green'}else{'Red'}) # Check whether the system is actually using these Settings Write-Host "=== system current state ===" -ForegroundColor Yellow Write-Host "Activity code page: $(chcp)" # Check the regional Settings $culture = Get-WinSystemLocale Write-Host "System region: $($culture.Name)" Write-Host "system code page: $($culture.TextInfo.ANSICodePage)" # Check the code page of the current process $processACP = [System.Text.Encoding]::Default.CodePage Write-Host "Default process encoding: $processACP (CP$processACP)" Write-Host "OutputEncoding: $OutputEncoding" -ForegroundColor Yellow } 

related output:

PS D:\build\workspace\x'x'x> Verify-Registry-Settings === Verify registry Settings === ACP (ANSI code page): 65001 OEMCP (OEM code page): 65001 MACCP (Mac Code page): 65001 === system current state === Activity code page: Active code page: 65001 System region: zh-CN system code page: 936 Default process encoding: 65001 (CP65001) OutputEncoding: System.Text.UTF8Encoding 

it is garbled when svn info is directly output to the terminal:

PS D:\build\workspace\xxx> svn --version svn锛岀増鏈?1.8.17 (r1770682) 缂栬瘧浜?Nov 30 2016锛?3:25:58 鍦?x86-microsoft-windows ... 

It is normal to use pipes or redirects:

PS D:\build\workspace\xxx> $svnVersion = svn --version PS D:\build\workspace\xxx> Write-Host $svnVersion svn,版本 1.8.17 (r1770682) 编译于 Nov 30 2016,13:25:58 在 x86-microsoft-windows Copyright (C) 2016 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ 可使用以下的版本库访问模块: * ra_svn : 使用 svn 网络协议访问版本库的模块。 - 使用 Cyrus SASL 认证 - 处理“svn”方案 * ra_local : 访问本地磁盘的版本库模块。 - 处理“file”方案 * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - using serf 1.3.9 - 处理“http”方案 - 处理“https”方案 

i hope to keep the active page of 65001(utf-8) and that svn can output something similar to chinese without garbled characters.

New contributor
goodidea is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.