Back to Community

Fixing Character Encoding and Export Issues in CFDB7

20 threads Sep 11, 2025 PluginContact form 7 database addon – cfdb7

Content

Understanding Character Encoding and Export Problems in CFDB7

Many users of the 'Contact Form 7 Database Addon – CFDB7' plugin encounter issues when exporting form submissions containing special characters, line breaks, or specific data formats. These problems often manifest as garbled text (e.g., ñ instead of ñ), missing leading zeros in phone numbers, CSV formatting errors, or data appearing correctly in some applications but not others. This guide explains why these issues occur and provides the most effective solutions.

Why Do These Problems Happen?

The core of these issues typically lies in a mismatch of character encoding or how different software interprets the exported CSV file. The plugin stores data in the database correctly using UTF-8 encoding. However, the process of exporting that data and, more importantly, how it is opened by spreadsheet applications like Microsoft Excel, can introduce errors.

  • Excel's Default Behavior: Microsoft Excel does not automatically open CSV files with UTF-8 encoding by default. This is the most common reason special characters (Spanish ñ, German ü, Hebrew, Chinese, Cyrillic) appear corrupted.
  • Data Interpretation: Applications like Excel may interpret a comma within a text field as a new column delimiter or strip leading zeros from numbers, disrupting the data structure.
  • Line Breaks: Line breaks within a textarea field can also be misinterpreted by Excel, causing data to shift into wrong columns.

Common Solutions and Workarounds

Based on community feedback and successful resolutions, here are the most reliable methods to fix these export problems.

1. Fixing Special Characters (UTF-8 Encoding)

Solution A: Use Google Sheets
The simplest and most reliable solution is to avoid opening the CSV file directly in Excel. Instead, upload the file to Google Sheets, which handles UTF-8 encoding correctly by default.

  1. Download the CSV file from CFDB7.
  2. Go to Google Drive and upload the file.
  3. Right-click the file and choose "Open with" > "Google Sheets". The special characters should now display correctly.
  4. You can then download a properly formatted Excel file from Google Sheets if needed.

Solution B: Import into Excel Correctly
If you must use Excel, you must import the CSV file using the correct steps to specify UTF-8 encoding.

  1. Open Microsoft Excel to a blank workbook.
  2. Go to the Data tab.
  3. Click Get Data > From File > From Text/CSV.
  4. Select your downloaded CSV file.
  5. In the import wizard, ensure File Origin is set to 65001: Unicode (UTF-8).
  6. Click Load. Your data should now import with special characters intact.
Note: Simply double-clicking the file will likely result in corrupted characters.

Solution C: Manual Code Edit (Advanced Users)
Some users have reported success by manually modifying the plugin's export file. This involves adding utf8_encode() to the data processing function in wp-content/plugins/contact-form-cfdb-7/inc/export-csv.php. However, this edit will be overwritten whenever the plugin is updated and is not recommended for most users.

2. Preserving Leading Zeros in Phone Numbers

Excel automatically strips leading zeros from numbers it identifies. To preserve them:

  1. During the import process described in Solution B, when you see the data preview, select the column containing phone numbers.
  2. Change the column data format from General to Text.
  3. Click Load. The leading zeros will now be preserved.
Alternatively, using Google Sheets (Solution A) will also preserve the leading zeros correctly.

3. Handling Line Breaks and Commas in Text

If a textarea field contains line breaks or commas, it can break the CSV structure. The CFDB7 plugin should handle this by wrapping such fields in quotes. If data appears to be shifting columns when opened in Excel, using the proper import method (Solution B) instead of double-clicking the file will usually resolve the issue, as the import wizard correctly handles quoted fields.

Conclusion

In the vast majority of cases, character corruption and data formatting issues are not caused by the 'Contact Form 7 Database Addon – CFDB7' plugin losing data, but rather by how the exported CSV file is being opened. The database stores the information correctly. The most universal solution is to use Google Sheets to open your exports, or to learn the correct data import procedure for Microsoft Excel. For persistent issues, ensuring your WordPress site and database are fully configured for UTF-8 is also recommended.

Related Support Threads Support