Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:00:15+00:00 2026-06-17T05:00:15+00:00

I am attempting to run a sql query but get the following error: Incorrect

  • 0

I am attempting to run a sql query but get the following error:

Incorrect string value: '\xCC_a' for column

CSV File line that breaks mysql query:

Juan Gordon,GarcÃ_a,noman@gmail.com,,,,,,,,,,y,

SQL Error:

<p>Error Number: 1366</p><p>Incorrect string value: '\xCC_a' for column 'last_name' at row 1</p><p>INSERT INTO `phppos_people` (`first_name`, `last_name`, `email`, `phone_number`, `address_1`, `address_2`, `city`, `state`, `zip`, `country`, `comments`) VALUES ('Juan Gordon', 'Garc�_a', 'noman@test.com', '', '', '', '', '', '', '', '')</p><p>Filename: /Library/WebServer/Documents/phppos/PHP-Point-Of-Sale/models/person.php</p><p>Line Number: 75</p>  </div>

last_name is varchar(255) utf8_unicode_ci

$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_unicode_ci';

Example CSV code

?>


last_name = GarcÌ_a

UPDATE: I just learned that when saving the file as a .csv in excel the encoding is: Westren (Mac OS Roman) with CR as line breaks.

I think that file encoding might cause the problem. But I need to support it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:00:17+00:00Added an answer on June 17, 2026 at 5:00 am

    The only Excel that exports to Mac OS Roman apparently is MS Excel for OSX. Unfortunately I don’t have this so I can’t check how to export with the correct character set

    You now have two choices

    a) Convert the CSV to UTF-8 using iconv for example

    iconv -f MACROMAN -t UTF8 < yourfile.csv > yourfile-utf8.csv
    

    b) Set the connection charset to the character set of the file before you import

    SET NAMES macroman;
    

    In codeigniter this would look like this

    $this->db->simple_query('SET NAMES \'macroman\'');
    

    After your import is done, don’t forget to set it back

    $this->db->simple_query('SET NAMES \'utf8\'');
    

    Explanation:

    If your connection charset is UTF-8, your database excepts UTF-8 encoded data. If you set the connection charset to macroman and the columns you write to are UTF-8, MySQL will automatically convert this for you.

    From http://dev.mysql.com/doc/refman/5.5/en/charset-connection.html

    SET NAMES ‘charset_name’ [COLLATE ‘collation_name’]

    SET NAMES indicates what character set the client will use to send SQL statements to the server. Thus, SET NAMES ‘cp1251’ tells the server, “future incoming messages from this client are in character set cp1251.” It also specifies the character set that the server should use for sending results back to the client. (For example, it indicates what character set to use for column values if you use a SELECT statement.)

    On my freeBSD machine, MySQL has the macroman character set compiled in, I suppose you’ll also have this.

    mysql> SELECT * FROM information_schema.COLLATIONS WHERE CHARACTER_SET_NAME = 'macroman';
    +---------------------+--------------------+----+------------+-------------+---------+
    | COLLATION_NAME      | CHARACTER_SET_NAME | ID | IS_DEFAULT | IS_COMPILED | SORTLEN |
    +---------------------+--------------------+----+------------+-------------+---------+
    | macroman_general_ci | macroman           | 39 | Yes        | Yes         |       1 |
    | macroman_bin        | macroman           | 53 |            | Yes         |       1 |
    +---------------------+--------------------+----+------------+-------------+---------+
    

    Also see http://dev.mysql.com/doc/refman/5.5/en/charset-charsets.html

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get an error (1064) when attempting to run the following... (MySql 5.5.9) query:
I am attempting to run a simple SQL stored procedure query, but am getting
I'm attempting to run kohana classes in the install.php file but am having no
I'm attempting to run a file that calls multiple files, but I'm getting some
I'm attempting to run an SQL query to display the results of a set
I have a Premiums table that I attempting to query using the following LINQ-to-SQL:
I am attempting to run SQL on a table (called test_xml with a column
I am attempting to insert many records using T-SQL's MERGE statement, but my query
I am attempting to run a SQL query like this: $sql = mysql_query(select *
I am attempting to run the following query: (IF(book.book_type_id = 1, IF(inventory.cost < (follette_title.usedbuyingprice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.