I found a bug where, when you insert a item that has custom colors in it's name (Made using § in a NBT editor) in a anvil, the output comes without the § symbol, only the codes that came with the symbol stay. The lore stays fine. (I also found out that if while in the anvil you reach the limit of characters then the output colors get fixed (weird behavior))
Making some experiments I found that you can enchant a item with custom colors just fine in a enchanting table, that's why I think the anvil thing is a bug.
In the attachments I made a quick example of a sword with custom colors, and combined it with a enchanted book. I also attached some pictures about the fact that the colors stay when enchanting with a enchantment table. And the last picture is a example where I reach the character limit in the name editor and the item fixes itself for some reason.
When using the "fill the name" method to fix the output doesn't actually fix the output, what shows up in the output is fixed, but when removed form there, it is still broken.