screen乱码问题

在 .screenrc下设置:
defencoding gbk
encoding gbk gbk

detatch+reattach后,设置失效,这时可以直接用命令来配置:
ctrl+a
:defencoding gbk
:encoding gbk gbk

有可能是gbk换成utf-8
不行也可以source .screenrc来解决

git log 乱码:
在.bash_profile里面加入如下语句
export LESSCHARSET=utf-8

DONE
screen 乱码问题 未彻底解决
bin/s 脚本中的 username 改为 自己的username最终解决

转载于:https://www.cnblogs.com/mininice/p/3875417.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
感谢您的指正,screensize 的计算确实存在问题。在计算 screensize 时,我们需要考虑字节对齐的问题。 以下是修正后的代码: ```c #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <linux/fb.h> #include <sys/mman.h> #include <sys/ioctl.h> void drawBMP(const char *filename) { int fbfd = open("/dev/fb0", O_RDWR); if (fbfd == -1) { perror("Error: cannot open framebuffer device"); return; } struct fb_var_screeninfo vinfo; if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1) { perror("Error: reading variable screen info"); close(fbfd); return; } int bytesPerPixel = vinfo.bits_per_pixel / 8; int lineLength = vinfo.xres * bytesPerPixel; int screensize = lineLength * vinfo.yres; char *fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0); if ((int)fbp == -1) { perror("Error: failed to map framebuffer device to memory"); close(fbfd); return; } FILE *bmpfile = fopen(filename, "rb"); if (bmpfile == NULL) { perror("Error: cannot open BMP file"); munmap(fbp, screensize); close(fbfd); return; } unsigned char bmpheader[54]; if (fread(bmpheader, sizeof(unsigned char), 54, bmpfile) != 54) { perror("Error: invalid BMP file"); fclose(bmpfile); munmap(fbp, screensize); close(fbfd); return; } int width = *(int *)&bmpheader[18]; int height = *(int *)&bmpheader[22]; int bpp = *(int *)&bmpheader[28]; if (bpp != 24) { perror("Error: BMP file must be 24 bits per pixel"); fclose(bmpfile); munmap(fbp, screensize); close(fbfd); return; } int bmpLineLength = width * bytesPerPixel; int bmpPadding = (4 - (bmpLineLength % 4)) % 4; int bmpDataSize = (bmpLineLength + bmpPadding) * height; unsigned char *bmpdata = (unsigned char *)malloc(bmpDataSize); if (fread(bmpdata, sizeof(unsigned char), bmpDataSize, bmpfile) != bmpDataSize) { perror("Error: invalid BMP file"); fclose(bmpfile); free(bmpdata); munmap(fbp, screensize); close(fbfd); return; } int fbLinePadding = vinfo.xres_virtual - vinfo.xres; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { long location = (x + vinfo.xoffset) * bytesPerPixel + (y + vinfo.yoffset) * lineLength; unsigned char b = bmpdata[(x + (width * (height - y - 1))) * 3]; unsigned char g = bmpdata[(x + (width * (height - y - 1))) * 3 + 1]; unsigned char r = bmpdata[(x + (width * (height - y - 1))) * 3 + 2]; unsigned int color = ((r << vinfo.red.offset) & vinfo.red.msb) | ((g << vinfo.green.offset) & vinfo.green.msb) | ((b << vinfo.blue.offset) & vinfo.blue.msb); *((unsigned int *)(fbp + location)) = color; } } fclose(bmpfile); free(bmpdata); munmap(fbp, screensize); close(fbfd); } int main() { drawBMP("image.bmp"); return 0; } ``` 现在,计算 screensize 考虑了每行的字节对齐,确保了正确的数据大小和内存映射。 非常抱歉给您带来困扰,感谢您的指正。如果您还有任何问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值