BUG #9111: National characters in the user profile name - Mailing list pgsql-bugs

From cezary.dowhan@varico.pl
Subject BUG #9111: National characters in the user profile name
Date
Msg-id 20140205083415.26700.37722@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      9111
Logged by:          Cezary Dowhan
Email address:      cezary.dowhan@varico.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.

pgsql-bugs by date:

Previous
From: Michael.Oehme@kreis-warendorf.de
Date:
Subject: BUG #9110: Fresh install of psqlodbc_09_03_0100-x64.zip fails
Next
From: Alvaro Herrera
Date:
Subject: Re: Update with subselect sometimes returns wrong result