When you roast a pepper over an open flame, that burning/charring that happens on the outside is just that tougher outer skin that you are trying to get rid of. You are not actually burning the sweet flesh underneath.
So, you hold or place the peppers over the open flame, until the outer skins are blistered and scorched, rotating and turning the pepper with tongs. Once that is done, put the pepper into a paper bag to cool off. That traps some of the moisture escaping and further softens the scorched outer skin.
Give it a few shakes once cooked, take the pepper out, and the skin peels/flakes right off. I just do it under a running faucet so I'm not fighting with little bits and pieces of clinging skin.
The mistake most people make is that they don't thoroughly scorch the outer skin enough, because they mistakenly think they are burning the whole pepper.
For raw peppers, you'll have to go with some other answerers' suggestions.