
560 P.2d 1108 (1977)
Elma Arlene RAMMELL, Plaintiff and Appellant,
v.
Samuel SMITH, Warden, Utah State Prison, Defendant and Respondent.
No. 14618.
Supreme Court of Utah.
February 8, 1977.
Bradley Rich, of Salt Lake Legal Defenders Association, Salt Lake City, for plaintiff and appellant.
Vernon B. Romney, Atty. Gen., Earl F. Dorius, Asst. Atty. Gen., Salt Lake City, for defendant and respondent.
CROCKETT, Justice:
In a habeas corpus proceeding Elma Arlene Rammell challenges a sentence of a term not to exceed five years in the state prison for conviction of a felony under Sec. 58-37-8(4)(a)(ii), U.C.A. 1953, of the "Utah Controlled Substances Act," which provides:
It shall be unlawful for any person ... to acquire or obtain possession ... of a controlled substance by misrepresentation, fraud, forgery, deception, or subterfuge.[1]
Her contention is that she was entitled to be sentenced only for a misdemeanor under *1109 Sec. 58-17-14.13, U.C.A. 1953, of the "Pharmacists Act" which provides:
No person shall obtain or possess . . any drug . . . which under the laws of this state or the laws of the United States or lawful regulations thereunder, has been designated as unsafe for use except under the supervision of a practitioner ... (1) by fraud, deceit, misrepresentation or subterfuge, ...[2]
Petitioner had previously been convicted on a narcotics (controlled substance) charge and was on parole when she was arrested on October 23, 1975 and charged with the instant offense. On January 6, 1976 she pled guilty. On January 20, 1976, her parole was revoked and she was sentenced to a term of not to exceed five years in the state prison. Thereafter she filed a motion that the sentence for felony be vacated and that she be sentenced under the misdemeanor section 58-17-14.13. That motion was denied and this proceeding in habeas corpus was filed; and upon its denial this appeal was taken.
We first direct attention to the propriety of raising this issue in this habeas corpus proceeding. We have frequently had occasion to point out the error of attempting to use such a writ as a substitute for the prescribed appeal procedure.[3] However, the writ has its purposes, including the providing of a remedy where it challenges the jurisdiction of the court rendering the judgment,[4] or where the sentence imposed is one not authorized by law,[5] or where it is of an entirely different character than that which the statute prescribes,[6] so that it appears that a person is being held under an obviously illegal sentence and it would thus be unconscionable not to examine the issue.[7]
Proceeding to the main issue in this case; we agree with petitioner's premise that where there are two statutes which proscribe the same conduct, but impose different penalties, the violator is entitled to the lesser.[8] The difficulty with petitioner's argument is that the two statutes referred to do not prohibit exactly the same conduct. It will be noted that the above-quoted felony section under which petitioner was convicted is part of Chapter 37 of Title 58, U.C.A. 1953, the "Controlled Substances Act" which substances are set forth in section 58-37-4. They consist of opiates, narcotics, and various drugs which affect the mental and nervous systems and are for that reason regarded as deleterious substances and therefore are generally referred to as "hard drugs."
There is a significant and important difference between that statute and section 58-17-14.13 which creates the misdemeanor under which petitioner seeks the benefit of a lesser sentence. The latter section is in chapter 17 of Title 58, which is entitled, "Pharmacists." It deals generally with the dispensing of drugs by prescription and covers all drugs of every nature which have "been designated as unsafe for use except under the supervision of a practitioner," *1110 and it is not necessary that they be of the class of "hard drugs" proscribed in the "Controlled Substances Act." Inasmuch as the latter act applies more specifically to the petitioner's offense it takes precedence over the more general act.[9]
The trial court's decision finds further support in the fact that the legislature appears to have foreseen the possibility of such a problem as is presented in this case. In order to eliminate any conflict or misunderstanding it expressly provided in section 58-37-19, U.C.A. 1953, of the "Controlled Substances Act" that:
It is the purpose of this act to regulate and control the substances designated within section 58-37-4 and whenever ... the penalties imposed relating to substances controlled by this act shall be or appear to be in conflict with Title 58, Chapter 17 [Pharmacists] or any other laws of this state, the provisions of this act shall be controlling. [Emphasis added.]
In harmony with what has been said herein it is our opinion that the trial court was correct in ruling that the petitioner was properly charged, convicted and sentenced under the "Controlled Substances Act."
Affirmed. No costs awarded.
ELLETT, C.J., and MAUGHAN, WILKINS and HALL, JJ., concur.
NOTES
[1]  Sec. 58-37-8(4)(b) of the Act provides for punishment by imprisonment "for not more than five years or by a fine of not more than $5,000, or both."
[2]  Sec. 58-17-26 provides that any person who violates this section shall be punished by a fine of not more than $1,000, or imprisonment in the county jail for not more than one year, or both.
[3]  E.g., Brown v. Turner, 21 Utah 2d 96, 440 P.2d 968 (1968); Bryant v. Turner, 19 Utah 2d 284, 431 P.2d 121 (1967).
[4]  39 Am.Jur.2d Habeas Corpus, Sec. 28; Parker v. Talkington, 17 Or. App. 147, 521 P.2d 25 (1974); Sullivan v. Turner, 22 Utah 2d 85, 448 P.2d 907 (1968).
[5]  39 Am.Jur.2d Habeas Corpus, Sec. 67; In re Adams, 14 Cal.3d 629, 122 Cal. Rptr. 73, 536 P.2d 473 (1975); Sneed v. Cox, 74 N.M. 659, 397 P.2d 308 (1964); Application of Halverson, 339 P.2d 537 (Okl.Cr. 1959); Application of Landreth, 213 Or. 205, 324 P.2d 475 (1958).
[6]  76 A.L.R. 468, 495.
[7]  Cf. statement in Johnson v. Turner, 24 Utah 2d 439, 473 P.2d 901.
[8]  State v. Shondel, 22 Utah 2d 343, 453 P.2d 146 (1969).
[9]  73 Am.Jur.2d Statutes, Sec. 257; State v. Rice, 110 Ariz. 210, 516 P.2d 1222 (1973); In re Smart, 54 Haw. 250, 505 P.2d 1179 (1973).
