ColdFusion - Inserting arabic/persian characters to mysql

后端 未结 2 2035
死守一世寂寞
死守一世寂寞 2021-01-22 19:20

I insert my data into mysql db with this code:

     



        
2条回答
  •  日久生厌
    2021-01-22 19:44

    (From comments ...)

    Check the charset of your column or table. Make sure it supports unicode characters. For example, UTF-8:

    CREATE TABLE ( name varchar(500) CHARSET UTF8, ....)
    

    Also, instead of using N'literal' syntax, you may as well use the new cfsqltype cf_sql_nvarchar. With those changes, it should work fine.

        INSERT INTO ad ( name )  
        VALUES 
        (
            
           
        )
    

    Side note - Nothing to do with your question, but cfprocessingdirective has no effect here. It is used when you need to embed, or hard code, Unicode characters within a CF script. Since you are not doing that, you do not need it.

提交回复
热议问题