BUG #9111: National characters in the user profile name

From: cezary(dot)dowhan(at)varico(dot)pl
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #9111: National characters in the user profile name
Date: 2014-02-05 08:34:15
Message-ID: 20140205083415.26700.37722@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 9111
Logged by: Cezary Dowhan
Email address: cezary(dot)dowhan(at)varico(dot)pl
PostgreSQL version: 9.1.11
Operating system: Windows 7
Description:

I would like to show my solution to the bug 9026. The problem stems from the
fact that the console code page (OEMCP) is diffrent than default (system)
code page (ACP).

We must change the following fragment of code in initcluster.vbs:

' Execute a command
Function DoCmd(strCmd)
Dim objBatchFile
Set objBatchFile = objTempFolder.CreateTextFile(strBatchFile, True)
objBatchFile.WriteLine "@ECHO OFF"
objBatchFile.WriteLine strCmd & " > """ & strOutputFile & """ 2>&1"
objBatchFile.WriteLine "EXIT /B %ERRORLEVEL%"
objBatchFile.Close
WScript.Echo " Executing batch file '" & strBatchFile & "'..."
DoCmd = objShell.Run(objTempFolder.Path & "\" & strBatchFile, 0, True)
If objFso.FileExists(objTempFolder.Path & "\" & strBatchFile) = True
Then
objFso.DeleteFile objTempFolder.Path & "\" & strBatchFile, True
Else
WScript.Echo " Batch file '" & strBatchFile & "' does not
exist..."
End If
If objFso.FileExists(strOutputFile) = True Then
Dim objOutputFile
Set objOutputFile = objFso.OpenTextFile(strOutputFile, ForReading)
WScript.Echo " " & objOutputFile.ReadAll
objOutputFile.Close
objFso.DeleteFile strOutputFile, True
Else
WScript.Echo " Output file does not exists..."
End If
End Function

Should be:

' Execute a command
Function DoCmd(strCmd)
Dim objBatchFile
Set objBatchFile = objTempFolder.CreateTextFile(strBatchFile, True)
objBatchFile.WriteLine "@ECHO OFF"
objBatchFile.WriteLine "CHCP " &
objShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP")

objBatchFile.WriteLine strCmd & " > """ & strOutputFile & """ 2>&1"
objBatchFile.WriteLine "EXIT /B %ERRORLEVEL%"
objBatchFile.Close
WScript.Echo " Executing batch file '" & strBatchFile & "'..."
DoCmd = objShell.Run(objTempFolder.Path & "\" & strBatchFile, 0, True)
If objFso.FileExists(objTempFolder.Path & "\" & strBatchFile) = True
Then
objFso.DeleteFile objTempFolder.Path & "\" & strBatchFile, True
Else
WScript.Echo " Batch file '" & strBatchFile & "' does not
exist..."
End If
If objFso.FileExists(strOutputFile) = True Then
Dim objOutputFile
Set objOutputFile = objFso.OpenTextFile(strOutputFile, ForReading)
WScript.Echo " " & objOutputFile.ReadAll
objOutputFile.Close
objFso.DeleteFile strOutputFile, True
Else
WScript.Echo " Output file does not exists..."
End If
End Function

Probably the same change should be applied to other files.

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2014-02-05 14:22:18 Re: Update with subselect sometimes returns wrong result
Previous Message Michael.Oehme 2014-02-05 08:05:13 BUG #9110: Fresh install of psqlodbc_09_03_0100-x64.zip fails