ralberth / MMM-MysqlQuery

MagicMirror plug-in module that displays a table of MySQL SELECT results
MIT License
8 stars 3 forks source link

can't display utf-8 style code (module's falt, database is fine) #12

Closed bamil0 closed 1 year ago

bamil0 commented 2 years ago

the module can't display polish letters, for example "ą" which is utf-8 style coding. database is set to utf-8, so i think it's the module's fault. instead, it displays question marks (mąka - m?ka). what can i do with this?

ralberth commented 2 years ago

Sorry this has taken so long to get back to you! The design of the module takes whatever characters are returned from the database, and places them directly in the HTML without any changes. I just tried to reproduce what you're seeing, but I'm not getting "?" values.

My database setup:

create database magicmirror;
\u magicmirror

create table colors (
    num         int         auto_increment primary key,
    color_id    char(3)     not null,
    color_name  varchar(80) not null
);

insert into colors (color_id, color_name) values ('RED', 'é mąka');

My MagicMirror config.js entry:

{
    module: "MMM-MysqlQuery",
    position: "top_left",
    config: {
        connection: {
            host: "localhost",
            . . .
        },
        query: `select * from colors`,
        intervalSeconds: 15 * 60,
        emptyMessage: "No colors",
        columns: [
            { name: "color_id",   title: "Color ID" },
            { name: "color_name", title: "Name" }
        ]
    }
}

When I run this via npm start, I see "é mąka" in the second column.

What is your setup and configuration like?

bamil0 commented 1 year ago

hey, sorry for not reaching out. we've worked this out, it somehow fixed itself like a day after we made the issue here. thank you for your feedback and time regards