Witnesses in a habeas corpus case shall be subject to the same penalties, and be entitled to the same privileges and compensation, and be paid in the same way, as in other cases. They may prove their attendance before the clerk in whose office the record of the proceeding is filed, and obtain from him a certificate of their attendance and of the compensation to which they are entitled, as in cases in the circuit courts; or the judge trying the case may give the witnesses certificates of their attendance and the compensation to which they are entitled, which shall have the same effect as such certificates in a like case by the clerk.