RKCVTEUC(3)

✨ RKCVTEUC(3) ✨

okay so bestie, we're in the Library Functions Manual today and this one's a lil cutie: RkCvtEuc πŸŽ€ it's the glow-up translator that takes your shift JIS text and turns it into EUC text. no cap, that's the whole vibe.


πŸ’– NAME πŸ’–

RkCvtEuc β€” convert shift JIS code to EUC code

like. it literally does what it says on the tin. iconic behavior fr fr πŸ¦‹


🌸 SYNOPSIS 🌸

#include <canna/RK.h>
int RkCvtEuc(dst, maxdst, src, srclen)
unsigned char *dst;
int maxdst;
unsigned char *src;
int srclen;

she's giving very much old-school K&R prototype energy and we respect it πŸ’…


🫢 DESCRIPTION 🫢

so here's the tea β˜• RkCvtEuc takes srclen bytes of shift JIS data starting at the area src and converts them into EUC. that's it. that's the job.

⚠️ important: a null character in src is not interpreted as the end of the string. she does not stop at \0, she keeps going for the full srclen bytes. do not be fooled bestie 😭

the conversion result gets dropped into the area dst. characters that aren't subject to conversion? they just get copied over as they are, untouched, no notes. πŸ’

now for the fiddly bit β€” if the byte length of the conversion result exceeds maxdst - 1, the result gets truncated so it lines up with character boundaries in the EUC code. we're not out here slicing a character in half, that would be a crime πŸ’€ boundaries only, periodt.

and if there's room, dst gets padded with null characters at the end. she's polite like that. 🌸

hot tip πŸŽ€ NULL can be specified in dst. and NULL overrides the entire conversion result. like, the whole thing. bye ✨

πŸ‘‘ RETURN VALUE πŸ‘‘

  • she returns the byte length of the conversion result πŸ”₯
  • or she returns 0 if the value of maxdst is invalid. that's the "girl what did you pass me" signal πŸ™ˆ

and that's the whole page, bestie! πŸ’œ this lil number lives in the Library Functions Manual and goes by RKCVTEUC(3). mwah, go convert something cute πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from