求Mac端Notepad++替代工具:处理Excel转UTF-8 CSV及字符校验
Hey there! I’ve been right where you are—fumbling with Magento CSV imports on a Mac after being used to Notepad++ on Windows. No worries, there are solid native and free tools that get the job done, including handling UTF-8 encoding and those pesky special characters that break imports. Let’s dive in:
Mac Tools to Replace Notepad++ for Magento CSV Prep (UTF-8 + Special Character Cleanup)
1. Mac Built-in: TextEdit (No Extra Downloads Needed)
Perfect if you want to avoid installing third-party apps:
- First, export your Excel file to CSV directly from Excel: Go to File > Save As and choose CSV format.
- Open the CSV in TextEdit, then switch to plain text mode: Format > Make Plain Text (critical—rich text will mess up your CSV structure).
- Save as UTF-8: Go to File > Save, click the Advanced Options dropdown at the bottom left. Select Unicode (UTF-8) as the encoding, check "Ignore rich text commands", then save.
- Clean special characters:
- Use Cmd + F to open Find & Replace, click "Show Replace".
- For curly quotes (
“”‘’), replace them with straight quotes ("" ''). Enable regex mode (click the dropdown next to the search box > Use Regular Expression) and search for[\u201C\u201D]to replace with", and[\u2018\u2019]to replace with'. - For non-standard hyphens (like en-dashes, em-dashes), search for
[\u2010-\u2015]and replace with-. - For accented characters, if Magento doesn’t handle them well, replace individual ones (e.g.,
é→e) or use the Character Viewer (Edit > Emoji & Symbols) to find and replace.
2. Visual Studio Code (Free, Powerful & Recommended)
This is my go-to for CSV prep on Mac—it’s way more flexible than TextEdit for regex and batch edits:
- Export your Excel file to CSV first.
- Open the CSV in VS Code. Check the bottom-right corner for the current encoding (e.g.,
GB2312orISO-8859-1). Click that encoding label, select Reopen with Encoding > UTF-8, then click again and select Save with Encoding > UTF-8. - Clean special characters:
- Open Find & Replace with Cmd + F, click the
.*button to enable regex mode. - Curly quotes: Search
[\u201C\u201D]→ replace with"; search[\u2018\u2019]→ replace with'. - Hyphens/dashes: Search
[\u2010-\u2015]→ replace with-. - For accented characters, install the free extension Replace Special Characters from the VS Code marketplace to bulk replace accented letters with their plain counterparts.
- Open Find & Replace with Cmd + F, click the
3. Command Line (Great for Bulk Processing)
If you have multiple CSV files to handle, the terminal is your friend:
- Export your Excel files to CSV and put them in a single folder.
- Open Terminal and navigate to that folder:
cd /path/to/your/csv/folder - Convert to UTF-8 (replace
GB2312with your CSV’s current encoding if needed):iconv -f GB2312 -t UTF-8 input.csv > output_utf8.csv - Clean special characters with
sed(this handles Windows curly quotes; adjust the hex codes if your characters are different):sed -e 's/[\x93\x94]/"/g' -e 's/[\x91\x92]/'\''/g' output_utf8.csv > cleaned_final.csv
Quick Magento Import Tips
- After cleaning, always preview your CSV in Magento’s Import tool first—this will catch any remaining issues before you run the full import.
- Make sure there are no extra blank rows at the end of the CSV; these often cause import failures.
- Double-check that your column headers match Magento’s attribute names exactly (case-sensitive in some versions).
内容的提问来源于stack exchange,提问作者Promo
相关产品推荐
相关产品推荐

