Skip to content

Commit

Permalink
Standardize on lowercase encoding name
Browse files Browse the repository at this point in the history
This seems a little more readable and consistent with Microsoft documentation.
  • Loading branch information
joyfullservice committed Mar 8, 2021
1 parent 331dc00 commit e960642
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Version Control.accda.src/modules/clsDbTableData.bas
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Private Sub ImportTableDataTDF(strFile As String)
' Read file line by line
Set stm = New ADODB.Stream
With stm
.Charset = "UTF-8"
.Charset = "utf-8"
.Open
.LoadFromFile strFile
End With
Expand Down
4 changes: 2 additions & 2 deletions Version Control.accda.src/modules/modEncoding.bas
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Public Sub ConvertUcs2Utf8(strSourceFile As String, strDestinationFile As String

Else
' Fully encoded as UTF-16
ReEncodeFile strSourceFile, "UTF-16", strDestinationFile, "UTF-8"
ReEncodeFile strSourceFile, "utf-16", strDestinationFile, "utf-8"
End If

' Remove the source (temp) file if specified
Expand Down Expand Up @@ -179,7 +179,7 @@ Public Sub ConvertUtf8Ucs2(strSourceFile As String, strDestinationFile As String
End If
Else
' Encode as UCS2-LE (UTF-16 LE)
ReEncodeFile strSourceFile, "UTF-8", strDestinationFile, "UTF-16"
ReEncodeFile strSourceFile, "utf-8", strDestinationFile, "utf-16"

' Remove original file if specified.
If blnDeleteSourceFileAfterConversion Then DeleteFile strSourceFile, True
Expand Down
6 changes: 3 additions & 3 deletions Version Control.accda.src/modules/modFileAccess.bas
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ End Function
' : Read in UTF-8 encoding, removing a BOM if found at start of file.
'---------------------------------------------------------------------------------------
'
Public Function ReadFile(strPath As String, Optional strCharset As String = "UTF-8") As String
Public Function ReadFile(strPath As String, Optional strCharset As String = "utf-8") As String

Dim strText As String
Dim cData As clsConcat
Dim strBom As String

' Get BOM header, if applicable
Select Case strCharset
Case "UTF-8": strBom = UTF8_BOM
Case "utf-8": strBom = UTF8_BOM
Case "Unicode": strBom = UCS2_BOM
End Select

Expand Down Expand Up @@ -112,7 +112,7 @@ Public Sub WriteFile(strText As String, strPath As String)
With New ADODB.Stream
.Type = adTypeText
.Open
.Charset = "UTF-8"
.Charset = "utf-8"
.WriteText strText
' Ensure that we are ending the content with a vbcrlf
If Right(strText, 2) <> vbCrLf Then .WriteText vbCrLf
Expand Down
2 changes: 1 addition & 1 deletion Version Control.accda.src/modules/modSanitize.bas
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Public Sub SanitizeXML(strPath As String, Options As clsOptions)

' Open file to read contents line by line.
Set stmInFile = New ADODB.Stream
stmInFile.Charset = "UTF-8"
stmInFile.Charset = "utf-8"
stmInFile.Open
stmInFile.LoadFromFile strPath
strText = stmInFile.ReadText(adReadLine)
Expand Down
4 changes: 2 additions & 2 deletions Version Control.accda.src/modules/modUnitTesting.bas
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ End Sub
Private Function Utf8BytesToString(abUtf8Array() As Byte) As String

With New ADODB.Stream
.Charset = "UTF-8"
.Charset = "utf-8"
.Open
.Type = adTypeBinary
.Write abUtf8Array
Expand All @@ -256,7 +256,7 @@ End Function
Private Function Utf8BytesFromString(strInput As String) As Byte()

With New ADODB.Stream
.Charset = "UTF-8"
.Charset = "utf-8"
.Open
.Type = adTypeText
.WriteText strInput
Expand Down

0 comments on commit e960642

Please sign in to comment.