Err, be very careful, correct in part - dot 3, dot 4 and dot 5.1 are compatible as they are glycol based and have increasing temperature ratings. Dot 5 is silicone based, entirely different and not compatible with other fluids.
If you are going to substitute dot 5 for 3 or 4 you may well be advised to either wash the system out or replace the rubbers in both cylinders.