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

  • SEARCH
  • Home
  • 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 6759319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:55:28+00:00 2026-05-26T13:55:28+00:00

On a database I’ll have to store names and such in UTF8, and hashes

  • 0

On a database I’ll have to store names and such in UTF8, and hashes in latin1_bin. I called SET NAMES utf8, but I noticed that it corrupted the latin1 fields when I tried to read them (I was able to write them just fine). Which is odd, since if I understood correctly that query is only about sending data to the server, not receiving it.

phpMyAdmin displays broken data too.

Any clue about what I might be doing wrong?

(using MAMP 1.9.6)

edit: this answer specifies this is also the charset used to send data back to the client. I’m getting confused: what’s the point of specifying the charset of a column if that will be ignored anyway?

edit:
excerpt from the column definition:

  `tok` char(64) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
  `sal` char(16) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
...
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_roman_ci ;

excerpt from queries:

SELECT tok,sal FROM user WHERE id=4 LIMIT 1

.

INSERT INTO user (tok, sal) VALUES (x'1387ea0c22277d3000bd23241c357e3a9ba45a2e28f50581d63a73bf785a7458a95cca4de27d0a86588f5bdfa94415d6a255c2c0379ebc2f00dacba03ae6b866', x'8fca28a592c29f245ff0a3ba5f97420c')
  • 1 1 Answer
  • 1 View
  • 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-05-26T13:55:29+00:00Added an answer on May 26, 2026 at 1:55 pm

    You should change your table definition to use MySql’s BINARY type, which is the perfect fit for this kind of data:

    The BINARY and VARBINARY types are similar to CHAR and VARCHAR, except
    that they contain binary strings rather than nonbinary strings. That
    is, they contain byte strings rather than character strings. This
    means that they have no character set, and sorting and comparison are
    based on the numeric values of the bytes in the values.

    The column definitions would become:

    `tok` binary(64) NOT NULL,
    `sal` binary(16) NOT NULL,
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

database/SQL novice here. I have a table with a column called, for example, EmployeeID.
My database contains records that have: 1) First line delimited with double \n\n and
Database server is Microsoft SQL Server, but I don't have Administrator access to it.
Database resources, that can be accessed from webpage that I'm currently working on, have
Database: DB2 v9.5 on AIX Scenario: I have 2 instances- db2inst1 and db2inst2. I
Database has tables Photos and PhotoAlbums. I need a query that will select all
A database application that I'm currently working on, stores all sorts of settings in
The Database Tuning Advisor is recommending that I create a bunch of statistics in
Database has table X and tables An, Bn, Cn, Dn that inherits from X.
Database is MySQL. I am looking to implement a trigger that updates an aggregate

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.