Arduino Uno writing garbage on SD card

Someone said yesterday that I should use a 74HC4050, but when I looked at the CD4050 datasheet this seems well within it's specs, so I don't intend to change.

I think the problem is that early CD4050 parts had classic ESD protection with a diode to Vcc. The input voltage is limited to Vcc + 0.5. For Vcc of 3.3V the allowed input voltage is too low for a 5V system.

These may appear to work OK by either dragging down input signals and/or raising 3.3V somewhat. The signals are reduced by at least some.

Modern CD4050B parts have ESD without the diode to Vcc. Some old style parts and parts in the LV family still are around. See this.

The 74HC4050 always works.

he 74HC4050 provides six non-inverting buffers with a modified input protection structure, which has no diode connected to Vcc. Input voltages of up to 15 V may therefore be used.