encode-coding-region

encode-coding-region is an interactive built-in function in `C source code'.


(encode-coding-region START END CODING-SYSTEM &optional DESTINATION)

Encode the current region by specified coding system.
When called from a program, takes four arguments:
START, END, CODING-SYSTEM and DESTINATION.
START and END are buffer positions.

Optional 4th arguments DESTINATION specifies where the encoded text goes.
If nil, the region between START and END is replace by the encoded text.
If buffer, the encoded text is inserted in that buffer after point (point
does not move).
In those cases, the length of the encoded text is returned.
If DESTINATION is t, the encoded text is returned.

This function sets `last-coding-system-used' to the precise coding system
used (which may be different from CODING-SYSTEM if CODING-SYSTEM is
not fully specified.)