Skip to content

Commit 95ce1ce

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 4b8d25a + c025260 commit 95ce1ce

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

inc/databaseConn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function getMeetingInfo($sectionData) {
7979
];
8080

8181
if (isset($sectionData['description'])) {
82-
$course['description'] = $sectionData['description'];
82+
$course['description'] = iconv("ISO-8859-1", "UTF-8", $sectionData['description']);
8383
}
8484

8585
// Make sure special sections don't get double-counted for their credits

tools/Parser.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ function fileToTempTable(string $tableName, $file, $fields, $fileSize, string $p
199199
while ($str = fgets($file, 4096)) {
200200
// Trim those damn newlines
201201
$str = trim($str);
202+
$str = iconv("ISO-8859-1", "UTF-8", $str);
202203

203204
// Progress bar
204205
if ($this->debugMode) {
@@ -238,8 +239,9 @@ function fileToTempTable(string $tableName, $file, $fields, $fileSize, string $p
238239
}
239240

240241
// Build a query
241-
$insQuery = "INSERT INTO {$tableName} VALUES('" . implode("', '", $lineSplit) . "')";
242-
if (!mysqli_query($this->dbConn, $insQuery)) {
242+
$stmt = $this->dbConn->prepare("INSERT INTO {$tableName} VALUES(" . implode(", ", array_fill(0, $fields, "?")) . ")");
243+
$stmt->bind_param(str_repeat("s", $fields), ...$lineSplit);
244+
if (!$stmt->execute()) {
243245
echo("*** Failed to insert {$tableName}\n");
244246
echo(" " . mysqli_error($this->dbConn) . "\n");
245247
continue;

0 commit comments

Comments
 (0)