INSERT INTO `channels` (`channel`)
VALUES ('zafé');
Vapor model: Channel.swift
import Vapor
import Fluent
import FluentSQL
final class Channel: Model {
static let schema = "channels"
public init() { }
@ID(custom: "channel", generatedBy: .user)
var id: String?
@Timestamp(key: "created_at", on: .create)
var created_at: Date?
}
extension Channel: Content { }
Read value
Channel.query(on: appInstance.db).all().whenSuccess { (channels: [Channel]) in
channels.forEach { (channel: Channel) in
print("meta: \(channel.id) ")
}
}
Expected: meta: zafé
Actual: meta: zaf�
Package.swift
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "Server",
platforms: [
.macOS(.v10_15)
],
products: [
.library(name: "Server", targets: ["App"]), // product name
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "4.35.0"), //vapor dep
.package(url: "https://github.com/vapor/leaf.git", from: "4.0.0"),
.package(url: "https://github.com/soto-project/soto.git", from: "5.0.0"), //aws sdk
.package(url: "https://github.com/vapor/fluent.git", from: "4.0.0"), // DB ORM
.package(url: "https://github.com/vapor/fluent-mysql-driver.git", from: "4.0.0"), //mysql
.package(url: "https://github.com/vapor/redis.git", from: "4.0.0"), //redis
.package(url: "https://github.com/CoreOffice/CoreXLSX.git", .upToNextMinor(from: "0.13.0")), //xlsx decoding
.package(url: "https://github.com/pankajsoni19/swift-backtrace.git", from: "1.4.0") //swift error logging utility
],
targets: [
.target(
name: "App",
dependencies: [
.product(name: "SotoS3", package: "soto"),
.product(name: "SotoSES", package: "soto"),
.product(name: "Leaf", package: "leaf"),
.product(name: "Fluent", package: "fluent"),
.product(name: "FluentMySQLDriver", package: "fluent-mysql-driver"),
.product(name: "Vapor", package: "vapor"),
.product(name: "Redis", package: "redis"),
.product(name: "CoreXLSX", package: "CoreXLSX"),
.product(name: "Backtrace", package: "swift-backtrace")
],
swiftSettings: [
// Enable better optimizations when building in Release configuration. Despite the use of
// the `.unsafeFlags` construct required by SwiftPM, this flag is recommended for Release
// builds. See <https://github.com/swift-server/guides#building-for-production> for details.
.unsafeFlags(["-cross-module-optimization"], .when(configuration: .release))
]),
.target(name: "Run", dependencies: [
.target(name: "App")
])
]
)
Describe the bug
Fail to decode data correctly to string from mysql.
To Reproduce
Mariadb: AWS RDS
Insert into table
Vapor model:
Channel.swift
Read value
Expected:
meta: zafé
Actual:meta: zaf�
Package.swift