You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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")
])
]
)
The text was updated successfully, but these errors were encountered:
pankajsoni19
changed the title
Fluent cannot decode utf8mb4_unicode_ci to string
Fluent cannot decode utf8mb4_unicode_ci to string from mysql
Jan 4, 2021
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
The text was updated successfully, but these errors were encountered: